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.
精彩评论