**首先我在IsMouseOver时遇到了改变背景的问题,但是我 修复了它,现在我的触发器不会起作用 IsAnabled ="假"但背景和前景工作。下面是代码:**
<Style TargetType="{x:Type Button}" x:Key="btnBase">
<Setter Property="Foreground" Value="{DynamicResource btnBaseForegroundColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource btnBaseBorderBrushColor}"/>
<Setter Property="Background" Value="{DynamicResource btnBaseBackgroundColor}"/>
<Setter Property="FontFamily" Value="/Resources/Fonts/Source Sans Pro/#Source Sans Pro"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Padding" Value="14,3,14,3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" BorderThickness="1" Padding="14,3,14,3" >
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#65A83B"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="BorderBrush" Value="Yellow"/>
<Setter Property="Background" Value="LightGray"/>
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="BorderThickness" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>