Hello all,
In a WPF form, I have the following TextBlock. When I move my mouse over it, I would like to see the text of the TextBlock underlined. How can I do that? I tried with TextBlock.Triggers, but it didn't work.
Thanks!
Hello all,
In a WPF form, I have the following TextBlock. When I move my mouse over it, I would like to see the text of the TextBlock underlined. How can I do that? I tried with TextBlock.Triggers, but it didn't work.
Thanks!
Use a style:
<TextBlock Text="Hurrah">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
(Style shown inline for brevity; extract into a resource if you're planning to reuse it.)
You may find this link helpful: http://msdn.microsoft.com/en-us/library/system.windows.textdecorations.underline.aspx