wpfxamlbordertextblock

Why is the border of my textblock not a border?


I have just created this TextBlock in my XAML file:

<TextBlock Text="blabla"> <Border BorderBrush="Black" BorderThickness="1" /> </TextBlock>

I was expecting the word "blabla" with a black border (around it), but instead I get this:

enter image description here

Please mind the very tiny black square in the left bottom edge :-)

Can anybody tell me how to put a border around my TextBlock?


Solution

  • The TextBlock needs to be wrapped by the Border. Example:

    <Border BorderThickness="1" BorderBrush="Black">
        <TextBlock Text="blabla"></TextBlock>
    </Border>