【发布时间】:2016-06-04 13:21:04
【问题描述】:
如何更改 BorderBrush 和 Background 上的复选框 MouseOver 的颜色?我试过这种方法,但它不起作用:
<CheckBox Style="{DynamicResource checkBox}">CheckBoxText</CheckBox>
这是我的风格:
<Style TargetType="{x:Type CheckBox}" x:Key="checkBox">
<!-- This part changes the colors -->
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="3" />
<Setter Property="Background" Value="LightGray" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!-- This part is not changing the colors -->
<Setter Property="BorderThickness" Value="3" />
<Setter Property="Background" Value="Gray" />
<Setter Property="BorderBrush" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
更改这些颜色适用于<Trigger Property="IsChecked" Value="True"> 条件。但它不适用于IsMouseOver。
【问题讨论】:
标签: wpf xaml checkbox mouseover