Reputation: 1335
I have a System.Windows.Controls.Label in my xaml and I'm trying to add an underline style. I can't seem to figure out what to add to my Style to make it underline. When I google for this problem, I only see TextBox solutions. Is that the only way to get an underline?
XAML:
<sdk:Label Content="Show Data in Grid" Name="lblShowGridData" Style="{StaticResource UnderlineLabel}"/>
Style:
<Style x:Key="UnderlineLabel" TargetType="sdk:Label">
<Setter Property="FontWeight" Value="Bold"/>
</Style>
Upvotes: 2
Views: 3231
Reputation: 64959
A Label
is a ContentControl
, so you can stick a TextBlock
with underlining inside it:
<sdk:Label>
<TextBlock Text="This is underlined" TextDecorations="Underline" />
</sdk:Label>
Upvotes: 4