[英]Hover effect in style doesn't work (ToolBarPanel) - WPF c#
我有一个工具栏面板,我已经制作了自定义样式。
<Window.Resources>
<Style x:Key="toolbar_opciones" TargetType="{x:Type ToolBarPanel}">
<Setter Property="Background" Value="DeepSkyBlue"/> <!-- does not work -->
<Setter Property="Cursor" Value="Hand"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="CadetBlue"/>
</Trigger> <!-- does not work -->
</Style.Triggers>
</Style>
</Window.Resources>
<ToolBarPanel Style="{StaticResource toolbar_opciones}"/>
光标工作,但背景属性没有,为什么?
我测试了你的代码,这是修复
<ToolBarPanel Style="{StaticResource toolbar_opciones}"/>
仔细看看,你错过了关闭Style
属性的双引号。 当我将它添加到XAML
,已应用Background
。
干杯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.