Friday, August 29, 2008

Understanding WPF Routed Events

Did you know that MouseDown is a bubble event and PreviewMouseDown is a tunnel event? Bubble and tunnel are actually two of the available Routing Strategies used by Routed Events in WPF. If you think of a user interface as a hierarchy of visual elements, bubble events propagate from a source element up the the visual tree until they are either handled or reach the root element. Tunnel events go in the opposite direction, starting at the root element and traverse down the element tree until they are handled or reach the source element for the event. These concepts are key to understanding WPF Routed Events.

There is a great article in the current edition of MSDN Magazine about Routed Events and Routed Commands. Read it for a better understanding of these two WPF technologies.

No comments:

Post a Comment