Files
ShrlAlgoToolkit/NeuWPF/NeoUI/Controls/Decorations/LightedSurface.xaml
ShrlAlgo 955a01f564 整理
2025-08-20 12:10:35 +08:00

62 lines
3.3 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type svd:LightedSurface}">
<Setter Property="Focusable" Value="False" />
<Setter Property="LightColorBrush" Value="#FF111319" />
<Setter Property="LightSize" Value="300" />
<Setter Property="Padding" Value="5" />
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type svd:LightedSurface}">
<ControlTemplate.Resources>
<Storyboard x:Key="ShowLight">
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetProperty="LightIntensity"
To="1" />
</Storyboard>
<Storyboard x:Key="HideLight">
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetProperty="LightIntensity"
To="0" />
</Storyboard>
</ControlTemplate.Resources>
<Border
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
x:Name="PART_lightBorder">
<Border BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ShowLight}" />
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource HideLight}" />
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>