WPF 处理事件覆盖对象
我有一些网格,顶部有覆盖画布。画布是透明的,我只能处理该画布上的鼠标事件。
问题是我想在适当的 Grid 对象而不是画布上处理 mouseDownEvents。
我尝试过路由事件,并尝试通过处理画布上已处理的网格事件来在 WPF 树中更深入地路由事件: grid.AddHandler(Grid.MouseDownEvent, new MouseButtonEventHandler(EducationMouseDown), true);
我还尝试在画布的处理程序中将 eventArgs 的 Handled 属性设置为 false。
不幸的是,这些尝试都没有奏效。
I have a some grids with a overlay canvas on top. The canvas is transparent and I can only handle mouse events on this canvas.
The problem is that I want to handle mouseDownEvents on the appropriate Grid object instead of the canvas.
I have experimented with routed events and tried to route events deeper in the WPF tree by handling events at the grid that are already handled by the canvas:
grid.AddHandler(Grid.MouseDownEvent, new MouseButtonEventHandler(EducationMouseDown), true);
I also tried to set the Handled property of the eventArgs to false in the handler of the canvas.
Unfortunately, non of these attemps worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在覆盖画布上设置
IsHitTestVisible="false"
。Try to set
IsHitTestVisible="false"
on your overlay canvas.