<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="BtnInfoStyle" TargetType="Button">
<Setter Property="Width" Value="80" />
<Setter Property="Height" Value="40" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#43a9ff" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="border"
Margin="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="True">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#2f96b4" />
<Setter Property="TextBlock.Cursor" Value="Hand" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#2a89a4" />
</Trigger>
<!--<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="border" Property="Background" Value="#2f96b4" />
</Trigger>-->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#C0C0C0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
标签:控件,C#,Button,样式,WPF,字典
From: https://www.cnblogs.com/qiutian-hao/p/18201513