|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Catel.Windows.Controls">
<Style TargetType="{x:Type local:LinkLabel}"
BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="HoverForeground" Value="Red"/>
<Setter Property="HyperlinkStyle">
<Setter.Value>
<Style TargetType="Hyperlink">
<Setter Property="Foreground" Value="{Binding RelativeSource=
{RelativeSource TemplatedParent}, Path=Foreground}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground"
Value="{Binding RelativeSource=
{RelativeSource TemplatedParent}, Path=HoverForeground}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:LinkLabel}">
<Border Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<TextBlock Background="{TemplateBinding Background}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<Hyperlink
x:Name="PART_InnerHyperlink"
NavigateUri="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Url}"
Style= "{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=HyperlinkStyle}"
Command="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Command}"
CommandParameter="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=CommandParameter}"
CommandTarget="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=CommandTarget}">
<local:BindableRun
BoundText="{Binding RelativeSource= {RelativeSource TemplatedParent}, Path=Content}"/>
</Hyperlink>
</TextBlock>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="LinkLabelBehavior" Value="NeverUnderline">
<Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="None"/>
</Trigger>
<Trigger Property="LinkLabelBehavior" Value="AlwaysUnderline">
<Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="Underline"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="true"/>
<Condition Property="LinkLabelBehavior" Value="HoverUnderline"/>
</MultiTrigger.Conditions>
<Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="Underline"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="false"/>
<Condition Property="LinkLabelBehavior" Value="HoverUnderline"/>
</MultiTrigger.Conditions>
<Setter TargetName="PART_InnerHyperlink" Property="TextDecorations" Value="None"/>
</MultiTrigger>
<Trigger SourceName="PART_InnerHyperlink" Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.