WPFwiki, wpf, wiki, .net 3.0, windows presentation foundation, FAQ, free resources, solution, development, microsoft Home of the world's largest WPF FAQ
Edit

Category

Routed Events

Edit

Question

Is there a naming convention for Routed Events?

Edit

Answer

Yes. While the naming convention is not formal nor enforced, it is suggested to prefix "Preview" to any Tunneling event. No such prefix exists for Bubbling events.

This prefix lets you identify the routing strategy of a routed event without having to see its declaration.

Also, this naming convention reflects the fact that most of the routed events already implemented will have a Tunneling event raised right before a Bubbling event is raised, hence the name "Preview".

Example:

A "PreviewMouseDown" event is always raised right before a "MouseDown" event occurs.

This lets the ancestors of the element actually receiving the mouse down intercept the event and react to it.

Generally speaking, if a "Preview" event is marked as handled, the Bubbling counterpart will not occur.

Edit

Keywords

preview, tunneling, tunnel, routed event

All content is Copyright ©2007 Xceed Software Inc. unless otherwise indicated. See the Terms of Service. Contributors must read and agree to the Contribution Policy. WPFwiki is brought to you by Xceed, makers of the powerful yet free Xceed DataGrid for WPF.