You are previewing Fluent C#.

Fluent C#

Cover of Fluent C# by Rebecca M. Riordan Published by Sams
O'Reilly logo

18. WPF Interactions

In the same way that WPF extends (adds functionality to) the basic .NET property mechanism, it also extends the .NET event pattern that we explored in Chapter 14 by introducing ROUTED EVENTS.

A standard .NET event can be handled by any object that registers a handler for it. WPF routed events can behave that way, too, but they can also travel up and down the logical tree, letting the event be handled by the most appropriate object in the logical tree. That’s particularly important in WPF because of the way objects are nested. When you create a Button, for example, you want to set an event handler on the Button itself, not on every one of its visual children.

After we’ve explored the WPF event model, we’ll examine WPF commands ...

The best content for your career. Discover unlimited learning on demand for around $1/day.