Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a border to the Text inside a TextBlock in WPF?

Tags:

wpf

textblock

I am kinda new to WPF, dont know if the question is weird. I wanted to know if its possible to add a border around the text inside a textBlock.

EDIT:

As per suggestion I have tried both but without much success:

<Border BorderBrush="#FF0B232F" BorderThickness="2">
   <TextBlock HorizontalAlignment="Left" Text="TextBlock" TextWrapping="Wrap" FontSize="36" FontWeight="Bold" Foreground="#FF88BCCD" OpacityMask="Black"/>      
</Border>

and

<Label BorderBrush="#FF0B232F" BorderThickness="2,2,2,2" Content="TextBlock" FontSize="36" FontWeight="Bold" Foreground="#FF88BCCD" />

Am I doing something wrong here?

like image 944
munna Avatar asked Feb 24 '11 13:02

munna


1 Answers

In such cases I use Label or TextBlock placed in Border.

like image 133
Y.Yanavichus Avatar answered Oct 06 '22 00:10

Y.Yanavichus