2025-04-11 01:24:01 +00:00
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
|
|
|
|
|
|
|
|
<!-- 定义默认颜色 -->
|
|
|
|
|
<SolidColorBrush x:Key="NormalColor" Color="Transparent"/>
|
|
|
|
|
<SolidColorBrush x:Key="HoverColor" Color="#FFEEEEEE"/>
|
|
|
|
|
<SolidColorBrush x:Key="PressedColor" Color="#FFDFDFDF"/>
|
|
|
|
|
|
|
|
|
|
<!-- 封装按钮样式 -->
|
|
|
|
|
<Style x:Key="SystemButtonStyle" TargetType="Button">
|
|
|
|
|
<!-- 重置关键属性 -->
|
|
|
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
|
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
|
|
<Setter Property="Padding" Value="0"/>
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
|
|
|
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="Button">
|
|
|
|
|
<!-- 使用双层布局确保事件穿透 -->
|
|
|
|
|
<Grid x:Name="RootGrid"
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
SnapsToDevicePixels="True">
|
|
|
|
|
|
|
|
|
|
<!-- 悬停效果层(必须放在内容层下方) -->
|
|
|
|
|
<Border x:Name="HoverLayer"
|
|
|
|
|
Background="Transparent"
|
|
|
|
|
CornerRadius="4"
|
|
|
|
|
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Grid}}"
|
|
|
|
|
Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Grid}}"/>
|
|
|
|
|
|
|
|
|
|
<!-- 内容容器(强制填充布局) -->
|
|
|
|
|
<ContentPresenter x:Name="ContentHost"
|
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
RecognizesAccessKey="True"/>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<!-- 交互状态管理 -->
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<!-- 鼠标悬停 -->
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter TargetName="HoverLayer"
|
|
|
|
|
Property="Background"
|
|
|
|
|
Value="#20000000"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
|
|
|
|
|
<!-- 按钮按下 -->
|
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
|
|
|
|
<Setter TargetName="HoverLayer"
|
|
|
|
|
Property="Background"
|
|
|
|
|
Value="#40000000"/>
|
|
|
|
|
<Setter TargetName="RootGrid"
|
|
|
|
|
Property="RenderTransform">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
2025-04-12 00:14:30 +00:00
|
|
|
|
|
|
|
|
<Style TargetType="Button" x:Key="NormalButtonStyle">
|
|
|
|
|
<Setter Property="Foreground" Value="#666"/>
|
|
|
|
|
<Setter Property="Background">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
|
|
|
|
<GradientStop Color="#028CF2" Offset="0"/>
|
|
|
|
|
<GradientStop Color="#0067F8" Offset="1"/>
|
|
|
|
|
</LinearGradientBrush>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="Button">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Border Background="{TemplateBinding Background}" CornerRadius="4">
|
|
|
|
|
<Border.Effect>
|
|
|
|
|
<DropShadowEffect BlurRadius="5" Color="Gray" ShadowDepth="0" Opacity="0.3"/>
|
|
|
|
|
</Border.Effect>
|
|
|
|
|
</Border>
|
|
|
|
|
<Border Background="Transparent" Name="back" CornerRadius="4"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|
|
|
|
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
Margin="{TemplateBinding Padding}"/>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Background" Value="#11000000" TargetName="back"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
2025-04-11 01:24:01 +00:00
|
|
|
</ResourceDictionary>
|