<Style x:Key="{x:Type Hyperlink}" TargetType="{x:Type Hyperlink}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="Red" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static GrayTextBrush}}" />
</Trigger>
<Trigger Property="IsEnabled" Value="true">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
<Setter Property="Foreground" Value="Blue" />
<Setter Property="TextDecorations" Value="Underline" />
</Style>
Oh, a slight surprise for me was that the hyperlink colors are not bound to any SystemColor members. No, they are just Red and Blue nailed in the style. Why?....
Wednesday, December 1, 2010
WPF Hyperlink default style
Tried to find the default style of a Hyperlink and discovered that neither Google, nor Expression Blend or ShowMeTheTemplate have it. So I had to disassemble WPF assembly with .NET Reflector+BAML viewer. Here is the style for Aero NormalColor theme, just for reference purposes:
Labels:
default style,
Hyperlink,
WPF
Subscribe to:
Post Comments (Atom)
Great job man! +1
ReplyDeleteI was looking for the system color for a hyperlink, so this post is very interesting! Thanks for the info.
ReplyDelete