[wpf] WPF Add a Border to a TextBlock

Is it possible to add a border to a textblock. I need it to be added in the setter property below code:

<Style x:Key="notCalled" TargetType="{x:Type TextBlock}">
    <Setter Property="Margin" Value="2,2,2,2" />
    <Setter Property="Background" Value="Transparent" />
</Style>

This question is related to wpf

The answer is


A TextBlock does not actually inherit from Control so it does not have properties that you would generally associate with a Control. Your best bet for adding a border in a style is to replace the TextBlock with a Label

See this link for more on the differences between a TextBlock and other Controls