Chapter 9. Getting a Handle on Events

What You’ll Learn in This Hour:

  • Routed events

  • Bubbling and tunneling

  • Arguments for routed events

  • Attached events

  • Preview events

  • Generic event handlers

WPF has introduced a rich system for tracking and responding to events. In this hour, we explore how this new event system functions, how it interacts with traditional events, and how you can leverage its power in your applications. Understanding this event model can be a little challenging. We’ll be digging deeper into the technology than in the previous hours.

What Are Routed Events?

An application in WPF consists of many elements in a tree. This can be seen in all our examples so far. A TextBlock could be nested inside a StackPanel, which could be inside a Grid, which ...

Get Sams Teach Yourself WPF in 24 Hours 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.