4
Reply

What is routed event in WPF?

Kunal Kumar

Kunal Kumar

10y
1.6k
0
Reply

    A routed event is a type of event that can invoke handlers on multiple listeners in an element tree rather than just the object that raised the event. It is basically a CLR event that is supported by an instance of the Routed Event class. It is registered with the WPF event system. RoutedEvents have three main routing strategies which are as follows -Direct Event Bubbling Event Tunnel Event

    http://msdn.microsoft.com/en-us/library/ms742806(v=vs.110).aspx

    http://wpftutorial.net/RoutedEvents.html

    A WPF user interface is constructed in a layered approach, where one visual element can have zero or more child elements. so we can visualise the elements tree for the full page. Routed events are a new feature provided by WPF which allows events to travel down the elements tree to the target element, or bubble up the elements tree to the root element. When an event is raised, it "travels" up or down the elements tree invoking handlers for that event on any element subscribed to that event it encounters en route.This tree traversal does not cover the entire elements tree, only the ancestral element chain between the root element and the element which is the target of the event.