首页 > 解决方案 > Ignoring Button Clicks without Disabling Button

问题描述

I'm looking for a way to ignore clicks on a Button without actually flipping it to IsEnabled="False" since disabling the button lightens it, making it inconsistent with the rest of my UI. Is this possible? Or is it perhaps possible to override the lightened style that is applied for that single button when disabled?

标签: wpfxaml

解决方案


有一个IsHitTestVisible属性可以设置为False

<Button Content="..." IsHitTestVisible="False" />

这将使Button“不可点击”。


推荐阅读