I created the following style:
<Style x:Key="LinkText" TargetType="{x:Type Label}">
<Setter Property="Label.FontFamily" Value="Verdana"/>
<Setter Property="Label.FontSize" Value="13"/>
<Setter Property="Label.Foreground" Value="Blue"/>
<Setter Property="TextBlock.TextDecorations" Value="Underline"/>
</Style>
But when I try to use it on some label the UnderLine is missing.
I wrote at my UserControl the next Label:
<Label Grid.Column="1" HorizontalAlignment="Right" Style="{StaticResource LinkText}">
<TextBlock>some text</TextBlock></Label>
I see all the style properties except the underLine propery How can I create Label style with underline?
Try to use a TextBlock
control instead of a Label
control. It behaves more or less exactly the same and should allow you to underline the text.
The TextBlock.TextDecorations
dependency property belongs to the TextBlock
control so you must use it to underline text.