Routed Events

The standard way that .NET classes and controls raise and handle events is essentially the way that you perform these tasks in WPF. But the WPF libraries bring an important improvement to standard events. We call these routed events.

Consider a simple scenario: You have a Button control that consists of a background image and some text (see Figure 19.19). If you recall from our discussion of a controls template and visual tree, this means we actually have a few discrete elements that make up the button: a TextBlock, an Image, and the basic frame and background of the button.

Figure 19.19 A button with multiple elements.

image

These are ...

Get Microsoft® Visual Studio® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.