WPF Template: AdornedElement not showing!

Posted by Tau Sick on Stack Overflow See other posts from Stack Overflow or by Tau Sick
Published on 2010-04-20T12:56:41Z Indexed on 2010/04/20 13:13 UTC
Read the original article Hit count: 324

I want to add some elements to a TextBox by using a Template with the extra elements and the original TextBox inserted in the right spot. I'm trying to use the AdornedElementPlaceholder just like you would do when making a Validation.ErrorTemplate But the AdornedElement is not showing up. I have simplified the example as much as possible:

<TextBox Text="Border me with my Template">
     <TextBox.Template>
      <ControlTemplate TargetType="{x:Type TextBox}">
       <Border BorderBrush="Green" BorderThickness="1">
        <AdornedElementPlaceholder/>
       </Border>
      </ControlTemplate>
     </TextBox.Template>
    </TextBox>  

The result is just a green box around the space that should be my textbox!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about adorner