Files
ShrlAlgoToolkit/AntDesignWPF/Controls/Hyperlink/Hyperlink.xaml
2025-07-31 20:12:24 +08:00

40 lines
2.6 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:AntDesignWPF.Controls"
xmlns:helpers="clr-namespace:AntDesignWPF.Helpers"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Controls/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 AntDesign.Brush.Link}" />
<Setter Property="helpers:AntControl.MouseOverForeground" Value="{Binding Foreground, Mode=OneWay, ConverterParameter=5, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorPaletteConverter}}" />
<Setter Property="helpers:AntControl.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
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="Content" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextElement.Foreground" TargetName="Content" Value="{Binding Path=(helpers:AntControl.MouseOverForeground), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="TextElement.Foreground" TargetName="Content" Value="{Binding Path=(helpers:AntControl.PressedForeground), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>