#598 – Three Flavors of Routed Events

In WPF, every routed event will adopt one of three different routing strategies:

  • Bubbling – the event propagates up the hierarchy of elements in the user interface
  • Tunneling – the event propagates down the hierarchy of elements
  • Direct – the event fires on the source element, but does not propagate

Routed events that are part of the WPF class libraries will have one of these three routing strategies.  For example:

  • ButtonBase.Click is a bubbling event
  • UIElement.PreviewKeyDown is a tunneling event
  • UIElement.MouseEnter is a direct event

When you define your own routed events, you can also specify one of these routing strategies for the event.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #598 – Three Flavors of Routed Events

  1. Pingback: #664 – MouseEnter and MouseLeave Events « 2,000 Things You Should Know About WPF

Leave a comment