motorTest/FeiYu/Styles.xaml
2026-10-17 11:39:30 +08:00

542 lines
38 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:FeiYu">
<!-- 程序自带字体 -->
<FontFamily x:Key="ziti1">../Resources/#方正宋一繁体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
<FontFamily x:Key="ziti2">../Resources/#苹果丽黑w36,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
<FontFamily x:Key="ziti3">../Resources/#微软繁宋体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
<FontFamily x:Key="ziti4">../Resources/#宋体-粗体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
<FontFamily x:Key="ziti5">../Resources/#行楷体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
<!-- Fill Brushes -->
<LinearGradientBrush x:Key="WindowBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0.0" Color="#ecf5fc" />
<GradientStop Offset="1.0" Color="#92cbf8" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<!-- 输入信号Label样式 -->
<Style x:Key="LabelStyle" TargetType="{x:Type Label}">
<Setter Property="Content" Value="Black" />
<Setter Property="Template">
<Setter.Value>
<!-- 设置样式 -->
<ControlTemplate TargetType="{x:Type Label}">
<Grid>
<!-- 设置背景透明度 -->
<Rectangle x:Name="Rectangle" Fill="{TemplateBinding Background}" Opacity="0.8" />
<!-- 显示原有文字内容 -->
<ContentPresenter x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 定义按钮样式 -->
<Style x:Key="RoundedButton" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="Black" />
<!-- 修改模板属性 -->
<Setter Property="Template">
<Setter.Value>
<!-- 控件模板 -->
<ControlTemplate TargetType="Button">
<!-- 背景色 -->
<Border x:Name="back" CornerRadius="3" Opacity="0.8">
<Border.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
</Border.BitmapEffect>
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
<GradientStop Offset="0.4" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
<GradientStop Offset="1" Color="#FFF" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<!-- 前景色及边框 -->
<Border x:Name="fore" BorderBrush="#5555" BorderThickness="2" CornerRadius="3">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0.5" Color="#6FFF" />
<GradientStop Offset="0.51" Color="#1111" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<!-- 按钮内容 -->
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
<ContentPresenter.BitmapEffect>
<DropShadowBitmapEffect Direction="-90" Opacity="0.3" ShadowDepth="2" Softness="0.1" Color="#000" />
</ContentPresenter.BitmapEffect>
</ContentPresenter>
</Border>
</Border>
<!-- 触发器 -->
<ControlTemplate.Triggers>
<!-- 鼠标移入移出 -->
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="6" Duration="0:0:0.2" />
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#AFFF" Duration="0:0:0.2" />
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#3FFF" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<!-- 按钮按下弹起 -->
<Trigger Property="IsPressed" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="3" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#3AAA" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#2111" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<!-- 按钮失效 -->
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#B444" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="0" Duration="0:0:0.3" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" To="1" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" To="-135" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" To="#FFF" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#D555" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#CEEE" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#CDDD" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 自定义checkBox控件 -->
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="False" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}" />
<Setter Property="Height" Value="25" />
<Setter Property="IsChecked" Value="False" />
<Setter Property="Margin" Value="0,20" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Width="{TemplateBinding Height}" Height="{TemplateBinding Height}">
<Rectangle x:Name="CheckBoxRectangle" Fill="{TemplateBinding Background}" Opacity="1" RadiusX="5" RadiusY="5" />
<Rectangle x:Name="CheckBoxRectangleOut" RadiusX="5" RadiusY="5" Stroke="#FF06DAD1" StrokeThickness="1" />
<Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
<Path Data="M1,9 L10,17" SnapsToDevicePixels="False" Stroke="White" StrokeThickness="3" />
<Path Data="M8,17 L20,4" SnapsToDevicePixels="False" Stroke="White" StrokeThickness="3" />
</Grid>
</Grid>
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="CheckedMark" Property="Visibility" Value="Visible" />
<!--<Setter TargetName="CheckBoxRectangle" Property="Fill" Value="#FF00A8E0"></Setter> -->
<!-- Value="#FF00A8E0" -->
<!--
<Setter TargetName="CheckBoxRectangle" Property="Opacity" Value="1"></Setter>-->
<Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CheckBoxStyle1" TargetType="{x:Type CheckBox}">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="False" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}" />
<Setter Property="Height" Value="25" />
<Setter Property="IsChecked" Value="False" />
<Setter Property="Margin" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Width="{TemplateBinding Height}" Height="{TemplateBinding Height}">
<Rectangle x:Name="CheckBoxRectangle" Fill="{TemplateBinding Background}" Opacity="1" RadiusX="5" RadiusY="5" />
<Rectangle x:Name="CheckBoxRectangleOut" RadiusX="5" RadiusY="5" Stroke="#FF06DAD1" StrokeThickness="1" />
<Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
<Path Data="M1,9 L10,17" SnapsToDevicePixels="False" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="3" />
<Path Data="M8,17 L20,4" SnapsToDevicePixels="False" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="3" />
</Grid>
</Grid>
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="CheckedMark" Property="Visibility" Value="Visible" />
<Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- *************************************************************************datagrid样式1******************************************************************************************** -->
<Style TargetType="DataGrid">
<!-- 网格线颜色 -->
<Setter Property="CanUserResizeColumns" Value="false" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="#FF9BBED6" />
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#FF7FAABD" />
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#FF7FAABD" />
</Setter.Value>
</Setter>
<Setter Property="AlternatingRowBackground" Value="AliceBlue" />
</Style>
<!-- Datagrid标题栏样式 -->
<Style TargetType="DataGridColumnHeader">
<!-- 标题居中 -->
<Setter Property="HorizontalContentAlignment" Value="Center" />
<!--<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="Foreground" Value="#323433" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
BorderBrush="#FF7FAABD"
Width="Auto">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="2" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="#FF9BBED6" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>-->
</Style>
<!-- *************************************************************************datagrid样式1******************************************************************************************** -->
<!-- *************************************************************************datagrid样式2******************************************************************************************** -->
<Style x:Key="DataGridStyle" TargetType="{x:Type DataGrid}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#FF9BBED6" />
<Setter Property="AlternatingRowBackground" Value="AliceBlue" />
<Setter Property="HorizontalGridLinesBrush" Value="#FF7FAABD" />
<Setter Property="VerticalGridLinesBrush" Value="#FF7FAABD" />
<!-- 不显示最左边的白框 -->
<Setter Property="HeadersVisibility" Value="Column" />
<!-- 不显示边框 -->
<Setter Property="BorderThickness" Value="0" />
<!-- 不自动生成列 -->
<Setter Property="AutoGenerateColumns" Value="False" />
<!-- 不自动生成行 -->
<Setter Property="CanUserAddRows" Value="False" />
<Setter Property="Margin" Value="0" />
<Setter Property="SelectionMode" Value="Single" />
</Style>
<!-- 行样式 -->
<Style x:Key="DataGridRowStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="White" />
</Style>
<!-- 标题样式 -->
<Style x:Key="DataGridHadeStyle" TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="20" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="AliceBlue" />
</Style>
<!-- DataGrid的行样式居中显示 -->
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<!-- *************************************************************************datagrid样式2******************************************************************************************** -->
<!-- 透明按钮2 -->
<Style x:Key="commBtn" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<!-- 修改模板属性 -->
<Setter Property="Template">
<Setter.Value>
<!-- 控件模板 -->
<ControlTemplate TargetType="Button">
<!-- 背景色 -->
<Border x:Name="back" CornerRadius="3" Opacity="1">
<Border.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
</Border.BitmapEffect>
<Border.Background>
<LinearGradientBrush Opacity="0.5" StartPoint="0,0" EndPoint="0,1.5">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
<GradientStop Offset="0.4" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
<GradientStop Offset="1" Color="#FFF" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<!-- 前景色及边框 -->
<Border x:Name="fore" BorderBrush="#5555" BorderThickness="1" CornerRadius="3">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0.1" Color="#6FFF" />
<GradientStop Offset="0.9" Color="#1111" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<!-- 按钮内容 -->
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
<ContentPresenter.BitmapEffect>
<!-- 文字阴影效果 -->
<!--<DropShadowBitmapEffect Color="White" Direction="-90" ShadowDepth="2" Softness="0.1" Opacity="0.3" />-->
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
</ContentPresenter.BitmapEffect>
</ContentPresenter>
</Border>
</Border>
<!-- 触发器 -->
<ControlTemplate.Triggers>
<!-- 鼠标移入移出 -->
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="6" Duration="0:0:0.2" />
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#AFFF" Duration="0:0:0.2" />
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#3FFF" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<!-- 按钮按下弹起 -->
<Trigger Property="IsPressed" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="3" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#3AAA" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#2111" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<!-- 按钮失效 -->
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#B444" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="0" Duration="0:0:0.3" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" To="1" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" To="-135" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" To="#FFF" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#D555" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#CEEE" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#CDDD" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" Duration="0:0:0.1" />
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 按钮样式1 -->
<Style x:Key="styleButton" TargetType="Button">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Rectangle Margin="4" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeDashArray="1 2" StrokeThickness="1" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="BorderBrush" Value="#00000000" />
<Setter Property="BorderThickness" Value="3" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="0,0,1,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="ContentContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="3" CornerRadius="5" SnapsToDevicePixels="True">
<ContentPresenter Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 字体随控件大小变化的label自定义控件 -->
<Style x:Key="Mylabel1" TargetType="{x:Type Label}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<Border Background="{TemplateBinding Background}">
<Viewbox>
<ContentControl Content="{TemplateBinding Content}" />
</Viewbox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 字体随控件大小变化的label自定义控件 -->
<Style x:Key="MyTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border Background="{TemplateBinding Background}">
<Viewbox>
<TextBox Text="{TemplateBinding Text}" />
</Viewbox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>