WPF,我的IsMouseOver of My Grid不会更改背景颜色


<Grid x:Name="set_bg" DockPanel.Dock="Top" Height="90" Background="Transparent" MouseDown="set_bg_MouseDown">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="DarkGoldenrod"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Image Height="66" Opacity="0.7" Source="/Images/settings.png" RenderOptions.BitmapScalingMode="HighQuality"/>
</Grid>

我真的不知道为什么这不起作用,尽管应该一切都很好

只需移除Background="Transparent"。触发器实际上是在更改背景颜色,但当它设置为透明时,无法查看。

最新更新