整理代码
This commit is contained in:
@@ -1,79 +1,79 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:Melskin.Assists"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||||
xmlns:converters="clr-namespace:Melskin.Converters"
|
||||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
||||
xmlns:markup="clr-namespace:Melskin.Markup"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:markup="clr-namespace:Melskin.Markup">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 按钮高亮 -->
|
||||
<Storyboard x:Key="Button.FocusEffect">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="Intensity"
|
||||
To="1" />
|
||||
To="1"
|
||||
Duration="0:0:0.2" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
|
||||
To="1.01" />
|
||||
To="1.01"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
|
||||
To="1.01" />
|
||||
To="1.01"
|
||||
Duration="0" />
|
||||
<BooleanAnimationUsingKeyFrames
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="ShaderEnabled">
|
||||
Storyboard.TargetProperty="ShaderEnabled"
|
||||
Duration="0">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0" Value="True" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<!-- 按钮取消高亮 -->
|
||||
<Storyboard x:Key="Button.LeaveEffect">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="Intensity"
|
||||
To="0" />
|
||||
To="0"
|
||||
Duration="0:0:0.2" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
|
||||
To="1" />
|
||||
To="1"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
|
||||
To="1" />
|
||||
To="1"
|
||||
Duration="0" />
|
||||
<BooleanAnimationUsingKeyFrames
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="ShaderEnabled">
|
||||
Storyboard.TargetProperty="ShaderEnabled"
|
||||
Duration="0:0:0.2">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0.2" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<!-- 按钮按下 -->
|
||||
<Storyboard x:Key="Button.PressEffect">
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
|
||||
To="0.99" />
|
||||
To="0.99"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
|
||||
To="0.99" />
|
||||
To="0.99"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="border"
|
||||
Storyboard.TargetProperty="Intensity"
|
||||
To="0.5" />
|
||||
To="0.5"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
|
||||
<!-- 普通按钮,浮动 -->
|
||||
<Style TargetType="{x:Type ButtonBase}" x:Key="FloatButtonStyle">
|
||||
<Style x:Key="FloatButtonStyle" TargetType="{x:Type ButtonBase}">
|
||||
<Setter Property="assists:ControlAssist.AppearanceType" Value="None" />
|
||||
<Setter Property="assists:ControlAssist.IconPlacement" Value="Left" />
|
||||
<Setter Property="assists:ControlAssist.IsRunning" Value="False" />
|
||||
@@ -103,6 +103,8 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ButtonBase}">
|
||||
<decorations:EmbossBorder
|
||||
x:Name="border"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -110,34 +112,32 @@
|
||||
DarkShadowBrush="{Binding Path=(assists:ShadingAssist.DarkShadowBrush), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Intensity="0"
|
||||
LightShadowBrush="{Binding Path=(assists:ShadingAssist.LightShadowBrush), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="0"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
ShaderEnabled="False"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
SnapsToDevicePixels="True">
|
||||
<DockPanel
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<!-- 图标 -->
|
||||
<ContentPresenter
|
||||
x:Name="Icon"
|
||||
Margin="0,0,5,0"
|
||||
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
DockPanel.Dock="{Binding Path=(assists:ControlAssist.IconPlacement), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
Margin="0,0,5,0"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
x:Name="Icon">
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<RotateTransform />
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
<!-- 内容 -->
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
x:Name="contentPresenter" />
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</DockPanel>
|
||||
<decorations:EmbossBorder.RenderTransform>
|
||||
<TransformGroup>
|
||||
@@ -152,13 +152,13 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- 前缀图标可见性 -->
|
||||
<Trigger Property="assists:ControlAssist.Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
||||
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<!-- 切换边框效果,显示阴影 -->
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{Binding Path=(assists:ShadingAssist.LightedBorder), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{Binding Path=(assists:ShadingAssist.LightedBorder), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Button.FocusEffect}" x:Name="showEffectBegin" />
|
||||
<BeginStoryboard x:Name="showEffectBegin" Storyboard="{StaticResource Button.FocusEffect}" />
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Button.LeaveEffect}" />
|
||||
@@ -167,7 +167,7 @@
|
||||
<!-- 缩减阴影,下压效果 -->
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Button.PressEffect}" x:Name="pressBegin" />
|
||||
<BeginStoryboard x:Name="pressBegin" Storyboard="{StaticResource Button.PressEffect}" />
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<RemoveStoryboard BeginStoryboardName="pressBegin" />
|
||||
@@ -175,8 +175,8 @@
|
||||
</Trigger>
|
||||
<!-- 按钮禁用效果 -->
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="border" Value="{Binding Path=(assists:ShadingAssist.DisabledBackground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{Binding Path=(assists:ShadingAssist.DisabledForeground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter TargetName="border" Property="Background" Value="{Binding Path=(assists:ShadingAssist.DisabledBackground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{Binding Path=(assists:ShadingAssist.DisabledForeground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Trigger>
|
||||
|
||||
<DataTrigger Binding="{Binding Path=(assists:ControlAssist.IsRunning), RelativeSource={RelativeSource Self}}" Value="True">
|
||||
@@ -204,9 +204,9 @@
|
||||
<!--<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />-->
|
||||
<Setter Property="assists:ShadingAssist.LightedBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource PrimaryNormalColor}" Offset="0" />
|
||||
<GradientStop Color="Transparent" Offset="0.5" />
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Offset="0" Color="{DynamicResource PrimaryNormalColor}" />
|
||||
<GradientStop Offset="0.5" Color="Transparent" />
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform Angle="45" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
@@ -222,9 +222,9 @@
|
||||
<Setter Property="assists:ShadingAssist.DisabledBackground" Value="{DynamicResource InfoDisabledBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightedBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource InfoColor}" Offset="0" />
|
||||
<GradientStop Color="Transparent" Offset="0.5" />
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Offset="0" Color="{DynamicResource InfoColor}" />
|
||||
<GradientStop Offset="0.5" Color="Transparent" />
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform Angle="45" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
@@ -240,9 +240,9 @@
|
||||
<Setter Property="assists:ShadingAssist.DisabledBackground" Value="{DynamicResource ErrorDisabledBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightedBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource ErrorColor}" Offset="0" />
|
||||
<GradientStop Color="Transparent" Offset="0.5" />
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Offset="0" Color="{DynamicResource ErrorColor}" />
|
||||
<GradientStop Offset="0.5" Color="Transparent" />
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform Angle="45" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
@@ -258,9 +258,9 @@
|
||||
<Setter Property="assists:ShadingAssist.DisabledBackground" Value="{DynamicResource WarningDisabledBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightedBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource WarningColor}" Offset="0" />
|
||||
<GradientStop Color="Transparent" Offset="0.5" />
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Offset="0" Color="{DynamicResource WarningColor}" />
|
||||
<GradientStop Offset="0.5" Color="Transparent" />
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform Angle="45" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
@@ -276,9 +276,9 @@
|
||||
<Setter Property="assists:ShadingAssist.DisabledBackground" Value="{DynamicResource SuccessDisabledBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightedBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0" />
|
||||
<GradientStop Color="Transparent" Offset="0.5" />
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Offset="0" Color="{DynamicResource SuccessColor}" />
|
||||
<GradientStop Offset="0.5" Color="Transparent" />
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform Angle="45" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
@@ -289,7 +289,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button" x:Key="EmbossIconButtonStyle">
|
||||
<Style x:Key="EmbossIconButtonStyle" TargetType="Button">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
@@ -303,52 +303,52 @@
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Intensity="0.8"
|
||||
ShaderEnabled="True"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
x:Name="emboss" />
|
||||
ShaderEnabled="True" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
Height="{TemplateBinding Width}"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Height="{TemplateBinding Width}"
|
||||
Intensity="0"
|
||||
Margin="0"
|
||||
ShaderEnabled="False"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
x:Name="slot">
|
||||
ShaderEnabled="False">
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Intensity" TargetName="emboss" Value="1" />
|
||||
<Setter Property="Foreground" TargetName="slot" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="1" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
<Setter Property="Intensity" TargetName="slot" Value="0.6" />
|
||||
<Setter Property="ShaderEnabled" TargetName="emboss" Value="False" />
|
||||
<Setter Property="Foreground" TargetName="slot" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
<Setter TargetName="slot" Property="ShaderEnabled" Value="True" />
|
||||
<Setter TargetName="slot" Property="Intensity" Value="0.6" />
|
||||
<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="emboss" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter TargetName="emboss" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<!--<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />-->
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
@@ -358,7 +358,7 @@
|
||||
</Style>
|
||||
|
||||
<!-- 拟态按钮,按下后显示深度效果 -->
|
||||
<Style TargetType="{x:Type Button}" x:Key="EmbossButtonStyle">
|
||||
<Style x:Key="EmbossButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
@@ -371,46 +371,46 @@
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0.8"
|
||||
ShaderEnabled="True"
|
||||
x:Name="emboss" />
|
||||
ShaderEnabled="True" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0"
|
||||
Margin="0"
|
||||
ShaderEnabled="False"
|
||||
x:Name="slot">
|
||||
ShaderEnabled="False">
|
||||
<ContentPresenter
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Intensity" TargetName="emboss" Value="0.4" />
|
||||
<Setter Property="Foreground" TargetName="slot" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="0.4" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
<Setter Property="Intensity" TargetName="slot" Value="0.6" />
|
||||
<Setter Property="ShaderEnabled" TargetName="emboss" Value="False" />
|
||||
<Setter Property="Foreground" TargetName="slot" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
<Setter TargetName="slot" Property="ShaderEnabled" Value="True" />
|
||||
<Setter TargetName="slot" Property="Intensity" Value="0.6" />
|
||||
<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="emboss" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter TargetName="emboss" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<!--<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />-->
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
@@ -419,7 +419,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="LightedButtonStyle">
|
||||
<Style x:Key="LightedButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
@@ -432,32 +432,32 @@
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<decorations:LightedSurface
|
||||
x:Name="surface"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Margin="0"
|
||||
x:Name="surface">
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</decorations:LightedSurface>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" TargetName="surface" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="surface" Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Foreground" TargetName="surface" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
<Setter TargetName="surface" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="surface" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter TargetName="surface" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -465,7 +465,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button" x:Key="IconButtonStyle">
|
||||
<Style x:Key="IconButtonStyle" TargetType="Button">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
@@ -478,36 +478,36 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
Height="{TemplateBinding Width}"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Height="{TemplateBinding Width}"
|
||||
Margin="0"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
x:Name="Border">
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}">
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="Border" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" TargetName="Border" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="Border" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -515,7 +515,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type ButtonBase}" x:Key="ButtonBaseStyle">
|
||||
<Style x:Key="ButtonBaseStyle" TargetType="{x:Type ButtonBase}">
|
||||
<!-- ================= 基础属性设置 ================= -->
|
||||
<Setter Property="assists:ControlAssist.AppearanceType" Value="None" />
|
||||
<Setter Property="assists:ControlAssist.IconPlacement" Value="Left" />
|
||||
@@ -536,45 +536,45 @@
|
||||
<Grid x:Name="RootGrid">
|
||||
<!-- 1. 底色层:显示按钮实际颜色 -->
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border" />
|
||||
SnapsToDevicePixels="True" />
|
||||
|
||||
<!-- 2. 交互遮罩层:用于变深/变浅 -->
|
||||
<!-- 默认为透明。Hover时变黑(加深),Press时变白(减淡) -->
|
||||
<Border
|
||||
x:Name="Overlay"
|
||||
Background="Black"
|
||||
CornerRadius="4"
|
||||
IsHitTestVisible="False"
|
||||
Opacity="0"
|
||||
x:Name="Overlay" />
|
||||
Opacity="0" />
|
||||
|
||||
<!-- 3. 内容层:文字和图标 -->
|
||||
<!-- 放在最上层,保证文字不被遮罩影响清晰度,且 Margin 绑定 Padding 撑开大小 -->
|
||||
<DockPanel
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
|
||||
<ContentPresenter
|
||||
x:Name="Icon"
|
||||
Content="{Binding Path=(assists:ControlAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
DockPanel.Dock="{Binding Path=(assists:ControlAssist.IconPlacement), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
x:Name="Icon">
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<RotateTransform />
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
x:Name="contentPresenter" />
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</DockPanel>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
@@ -583,10 +583,10 @@
|
||||
<VisualState x:Name="Normal">
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.15"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0" />
|
||||
To="0"
|
||||
Duration="0:0:0.15" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
@@ -595,15 +595,15 @@
|
||||
<Storyboard>
|
||||
<!-- 遮罩设为黑色,透明度 0.1 => 整体变暗 -->
|
||||
<ColorAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="Black" />
|
||||
To="Black"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.15"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.1" />
|
||||
To="0.1"
|
||||
Duration="0:0:0.15" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
@@ -612,25 +612,25 @@
|
||||
<Storyboard>
|
||||
<!-- 遮罩设为白色,透明度 0.2 => 整体变亮/发白 -->
|
||||
<ColorAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="White" />
|
||||
To="White"
|
||||
Duration="0" />
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.2" />
|
||||
To="0.2"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="Overlay"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0" />
|
||||
To="0"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -638,14 +638,14 @@
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="assists:ControlAssist.Icon" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed" />
|
||||
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Opacity" TargetName="Icon" Value="0.5" />
|
||||
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter TargetName="Icon" Property="Opacity" Value="0.5" />
|
||||
</Trigger>
|
||||
|
||||
<DataTrigger Binding="{Binding Path=(assists:ControlAssist.IsRunning), RelativeSource={RelativeSource Self}}" Value="True">
|
||||
|
||||
Reference in New Issue
Block a user