为什么这个触发器有效(当鼠标悬停在按钮上时将前景更改为“红色”)?
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Button Content="Hello"/>
</Grid>
但是,当按钮的前景色被设置为一种颜色(在本例中为“蓝色”)时,不包括此触发器?
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Button Foreground="Blue" Content="Hello"/>
</Grid>