开发者

WPF handling events overlay object

开发者 https://www.devze.com 2023-01-31 12:55 出处:网络
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.

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 ca开发者_Python百科nvas: 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.


Try to set IsHitTestVisible="false" on your overlay canvas.

0

精彩评论

暂无评论...
验证码 换一张
取 消