110,535
社区成员
发帖
与我相关
我的任务
分享
<Window x:Class="WPF2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF2"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style x:Key="ButtonNextStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="PART_Border" Background="#FFDC5555" Width="100" Height="70"/>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsPressed" Value="true">
<Setter TargetName="PART_Border" Property="Background" Value="blue"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="PART_Border" Property="Background" Value="#FF57E02F"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Button Style="{StaticResource ButtonNextStyle}"/>
</Grid>
</Window>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="PART_Border" Property="Background" Value="#FF57E02F"/>
</Trigger>
<Trigger Property="Button.IsPressed" Value="true">
<Setter TargetName="PART_Border" Property="Background" Value="blue"/>
</Trigger>
</ControlTemplate.Triggers>