Files
ShrlAlgoToolkit/AntdWpf/Styles/Hyperlink.xaml

48 lines
3.0 KiB
Plaintext
Raw Normal View History

2025-07-11 09:20:23 +08:00
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:AntdWpf.Controls"
xmlns:helpers="clr-namespace:AntdWpf.Helpers">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Control.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource Ant.TextElement}" TargetType="{x:Type controls:Hyperlink}">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="{DynamicResource LinkBrush}" />
<Setter Property="helpers:Control.MouseOverForeground"
Value="{Binding Foreground, Mode=OneWay, ConverterParameter=5,
RelativeSource={RelativeSource Self}, Converter={StaticResource ColorPaletteConverter}}" />
<Setter Property="helpers:Control.PressedForeground"
Value="{Binding Foreground, Mode=OneWay, ConverterParameter=7,
RelativeSource={RelativeSource Self}, Converter={StaticResource ColorPaletteConverter}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Hyperlink}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter x:Name="Content"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Content"
Property="TextElement.Foreground"
Value="{Binding Path=(helpers:Control.MouseOverForeground), Mode=OneWay,
RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Content"
Property="TextElement.Foreground"
Value="{Binding Path=(helpers:Control.PressedForeground), Mode=OneWay,
RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>