WPF Events

Now that you've learned how WPF events work, it's time to consider the rich variety of events that you can respond to in your code. Although every element exposes a dizzying array of events, the most important events usually fall into one of four categories:

  • Lifetime events. These events occur when the element is initialized, loaded, or unloaded.

  • Mouse events. These events are the result of mouse actions.

  • Keyboard events. These events are the result of keyboard actions (such as key presses).

  • Stylus events. These events are the result of using the penlike stylus, which takes the place of a mouse on a Table PC.

Taken together, mouse, keyboard, and stylus events are known as input events.

Lifetime Events

All elements raise events when ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition 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.