Chapter 7. Events

This chapter covers:

  • Bubble-up events
  • Tunnel-down events
  • Handling events even when they’ve already been handled
  • Class-level events
  • Clever ways to annoy your users

If you’ve used both MFC and Windows Forms, you’ll know that the event model in Windows Forms was a major improvement over the message-map model used by MFC. Controls in Windows Forms exposed events that could be subscribed to by code that cares, and that code was called when appropriate. The classic example is a user clicking a button, resulting in the appropriate handler being called. Many other events work in the same way.

Classic Windows Forms events did have some issues. The most problematic was that the code that cared about the event either needed to have ...

Get WPF in Action with Visual Studio 2008 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.