有什么办法让 WPF Adorner 忽略鼠标吗?

发布于 2024-08-24 06:38:44 字数 68 浏览 3 评论 0原文

有没有办法让 WPF 装饰器完全忽略鼠标,以便装饰器后面的 UIElement 仍然获取鼠标事件,就好像装饰器不存在一样?

Is there any way to make WPF adorner ignore mouse entirely so that the UIElement behind the adorner still gets mouse events as if the adorner does not exist?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇纵 2024-08-31 06:38:44

AdornerIsHitTestVisible 属性设置为 false

Set the IsHitTestVisible property of the Adorner to false

多孤肩上扛 2024-08-31 06:38:44

如果您使用鼠标事件的隧道版本而不是冒泡事件(即PreviewMouseDown而不是MouseDown),您将收到鼠标首先从 UIElement 获取事件,并能够通过将 e.Handled 设置为 true 来阻止它们到达装饰器。

If you use the tunneling version of the mouse events rather than the bubbling events (i.e., PreviewMouseDown instead of MouseDown), you will receive the mouse events from the UIElement first, and be able to stop them from reaching the adorner by setting e.Handled to true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文