8,757
社区成员
发帖
与我相关
我的任务
分享
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style x:Key="Style1" TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="16"></Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="BlanchedAlmond"></Setter>
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Button Style="{StaticResource Style1}" Margin="23,32,95,139" Content="按钮1"/>
</Grid>
</Window>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Button1">
<Setter.Value>
<SolidColorBrushColor="BlanchedAlmond" />
</Setter.Value>
</Setter>
</Trigger>
我的代码是这样写的,显示正常,不知道你的怎么回事。