My WPF user control consists of a few subcomponents, placed in such way that they overlap each other (sometimes completely), however they are on the same level on the visual tree (each subcomponent's parent is the main grid). I wish to pass mouse events from the topmost to the bottommost one, however default WPF's behavior passes them through the visual tree paths, not by their Z-order. Unfortunately, it is not possible to embed one in another (to take advantage of the default mechanisms). How may I resolve this problem?
Best regards -- Spook.
A straightforward solution would be to handle all events in your parent Grid by not attaching any handlers in the child controls and manually "route" the events based on child z-order to the grid's children.
It will require lots of manual work, but I can't seem to find any other way to implement custom routing strategies in WPF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With