开发者

C# WPF Controls within Controls and distinguishing LeftClick events!

开发者 https://www.devze.com 2022-12-21 00:37 出处:网络
I have UserControls within UserControls in WPF. This makes a tree structure starting from the root node.

I have UserControls within UserControls in WPF. This makes a tree structure starting from the root node.

I want to register for the event MouseLeftClickDown in all the UserControls. Left Clicking on a child control causes the event to fire for that control and all the parent controls that contain that child.

开发者_JAVA百科

When I click a child, I don't want to fire the event for any parent controls, I just want it to fire for the child control clicked.


You could use the MouseDownEvent. The MouseEventArgs passed to the handler should have a Handled property that if it is set to true indicates that the event should not be passed on to the controls higher up in the hierarchy.

0

精彩评论

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

关注公众号