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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.