MCI18n/Theme/MCButtonStyle.xaml

69 lines
3.5 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#48494a" />
<Setter Property="BorderBrush" Value="#373737" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Margin" Value="2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="Black" BorderThickness="2">
<Grid>
<!-- 按钮底部阴影 -->
<Border
x:Name="ShadowBorder"
Background="#313233"
CornerRadius="0" />
<!-- 按钮主体 -->
<Border
x:Name="MainBorder"
Margin="0,0,0,0"
Background="#5B5B5B"
BorderBrush="#373737"
BorderThickness="2,2,2,4"
CornerRadius="0">
<ContentPresenter
x:Name="ContentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!-- 鼠标悬停效果 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="MainBorder" Property="Background" Value="#6B6B6B" />
<Setter TargetName="MainBorder" Property="BorderBrush" Value="#cccccc" />
</Trigger>
<!-- 点击效果 -->
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="MainBorder" Property="Margin" Value="0,2,0,0" />
<Setter TargetName="MainBorder" Property="BorderThickness" Value="2,2,2,2" />
<Setter TargetName="ShadowBorder" Property="Visibility" Value="Hidden" />
</Trigger>
<!-- 禁用效果 -->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="MainBorder" Property="Background" Value="#3F3F3F" />
<Setter TargetName="MainBorder" Property="BorderBrush" Value="#2A2A2A" />
<Setter Property="Foreground" Value="#909090" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>