Subscribe to routed events even if they are handled
- Gérald Barré
WPF introduces the routed events. These are no longer specific to a single control but are "routed" through the hierarchy of controls.
To stop an event, just mark it as handled by setting the property
Handled to True in a handler. The WPF routing engine stops propagating it. Anyway, that's what you think. Actually, the event continues to go up but the different event handlers are no longer called.
Sometimes, you may want to subscribe to these blocked events, for instance when you use a control from a third-party publishers. This is quite possible!!!
myControl.AddHandler( routedEvent: TheEvent, handler: (RoutedEventHandler)MyHandler, handledEventsToo: true);
Do you have a question or a suggestion about this post? Contact me!
Enjoy this blog?💖 Sponsor on GitHub