827050faf0
- MainWindow.xaml: 绑定 IsChecked 到 IsMainViewportRealtimeEnabled - Generic.xaml: 修复 AnimatedSwitch 模板,添加初始状态 Setter 和 ExitActions 动画
121 lines
6.5 KiB
XML
121 lines
6.5 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:XplorePlane.Controls">
|
|
|
|
<Style TargetType="{x:Type controls:AnimatedSwitch}">
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="IsTabStop" Value="False" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="ClickMode" Value="Press" />
|
|
<Setter Property="IsThreeState" Value="False" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type controls:AnimatedSwitch}">
|
|
<Grid
|
|
Width="{TemplateBinding SwitchWidth}"
|
|
Height="{TemplateBinding SwitchHeight}"
|
|
Background="Transparent"
|
|
SnapsToDevicePixels="True">
|
|
<Border
|
|
x:Name="Track"
|
|
Background="#D5DCE3"
|
|
BorderBrush="#C9D1D8"
|
|
BorderThickness="1"
|
|
CornerRadius="12" />
|
|
|
|
<Border
|
|
x:Name="Thumb"
|
|
Width="18"
|
|
Height="18"
|
|
Margin="3,3,3,3"
|
|
HorizontalAlignment="Left"
|
|
Background="{TemplateBinding ThumbBrush}"
|
|
CornerRadius="9">
|
|
<Border.Effect>
|
|
<DropShadowEffect
|
|
BlurRadius="10"
|
|
Direction="270"
|
|
Opacity="0.2"
|
|
ShadowDepth="1" />
|
|
</Border.Effect>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="Thumb" Property="Margin" Value="23,3,3,3" />
|
|
<Setter TargetName="Track" Property="Background" Value="#2DCC70" />
|
|
<Trigger.EnterActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<ThicknessAnimation
|
|
Storyboard.TargetName="Thumb"
|
|
Storyboard.TargetProperty="Margin"
|
|
To="23,3,3,3"
|
|
Duration="0:0:0.18">
|
|
<ThicknessAnimation.EasingFunction>
|
|
<CubicEase EasingMode="EaseInOut" />
|
|
</ThicknessAnimation.EasingFunction>
|
|
</ThicknessAnimation>
|
|
<ColorAnimation
|
|
Storyboard.TargetName="Track"
|
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
|
To="#2DCC70"
|
|
Duration="0:0:0.18">
|
|
<ColorAnimation.EasingFunction>
|
|
<CubicEase EasingMode="EaseInOut" />
|
|
</ColorAnimation.EasingFunction>
|
|
</ColorAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.EnterActions>
|
|
<Trigger.ExitActions>
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<ThicknessAnimation
|
|
Storyboard.TargetName="Thumb"
|
|
Storyboard.TargetProperty="Margin"
|
|
To="3,3,3,3"
|
|
Duration="0:0:0.18">
|
|
<ThicknessAnimation.EasingFunction>
|
|
<CubicEase EasingMode="EaseInOut" />
|
|
</ThicknessAnimation.EasingFunction>
|
|
</ThicknessAnimation>
|
|
<ColorAnimation
|
|
Storyboard.TargetName="Track"
|
|
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
|
To="#D5DCE3"
|
|
Duration="0:0:0.18">
|
|
<ColorAnimation.EasingFunction>
|
|
<CubicEase EasingMode="EaseInOut" />
|
|
</ColorAnimation.EasingFunction>
|
|
</ColorAnimation>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</Trigger.ExitActions>
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="Track" Property="Opacity" Value="0.55" />
|
|
<Setter TargetName="Thumb" Property="Opacity" Value="0.8" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="Thumb" Property="Effect">
|
|
<Setter.Value>
|
|
<DropShadowEffect
|
|
BlurRadius="12"
|
|
Direction="270"
|
|
Opacity="0.24"
|
|
ShadowDepth="1" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ResourceDictionary> |