I have a usercontrol that creates more of itself, overlapping inside it as needed (its a sort of tree view). I wanted to add a highlight effect so I attached it to mouseenter/mouseleave events but as soon as I move the mouse over one of the child instances of the UC, the parent also receives the event and lights up.
I tried setting the e.handled = true assuming the event was passed down through the tree from child to parent but this is not the case, each instance of the nested controls generates their own event.
One way I could prevent this is when a control receives this event, it would scan through all of its children and grandchildren(etc) to see if any of those is also highlighted to prevent itself from doing that but I'm not sure the overlapping controls recieve the event in any particular order and this shouldn't be that difficult.
How can I prevent the event from triggering unless the control is the topmost visible one?