如果另一个触发器处于活动状态,则不触发触发器
我正在使用 ToggleButton 控件。我有 IsChecked 和 IsMouseOver 属性的触发器,可以更改背景和前景色。如果选中 ToggleButton,我不希望触发 IsMouseOver 触发器。这可能吗?
我当前的 ToggleButton 触发器:
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlSelectedBrush}"/>
<Setter TargetName="ToggleButtonText" Property="Foreground" Value="{DynamicResource ControlSelectedTextBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleButtonText" Property="Foreground" Value="{DynamicResource ControlHoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
I'm using a ToggleButton control. I have triggers for the IsChecked and IsMouseOver properties that change the background and foreground colors. I don't want the IsMouseOver trigger to fire if the ToggleButton is checked. Is this possible?
My current triggers for the ToggleButton:
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlSelectedBrush}"/>
<Setter TargetName="ToggleButtonText" Property="Foreground" Value="{DynamicResource ControlSelectedTextBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleButtonText" Property="Foreground" Value="{DynamicResource ControlHoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
MultiTrigger
和将其定义为附加条件。IE
Use a
MultiTrigger
and define that as an additional condition.i.e.