(The actual time that this represents isn??™t terribly important, but you can compare
different time stamp values to determine what event took place first. Larger time stamps signify
more recent events.) The Device returns an object that provides more information about
the device that triggered the event, which could be the mouse, the keyboard, or the stylus.
Each of these three possibilities is represented by a different class, all of which derive from the
abstract System.Windows.Input.InputDevice class.
In the rest of this chapter, you??™ll take a closer look at how you handle mouse and keyboard
actions in a WPF application.
CHAPTER 6 n DEPENDENCY PROPERTIES AND ROUTED EVENTS 169
Keyboard Input
When the user presses a key, a sequence of events unfolds. Table 6-5 lists these events in the
order that they occur.
Table 6-5. Keyboard Events for All Elements (in Order)
Name Routing Type Description
PreviewKeyDown Tunneling Occurs when a key is pressed.
KeyDown Bubbling Occurs when a key is pressed.
PreviewTextInput Tunneling Occurs when a keystroke is complete and
the element is receiving the text input.
This event isn??™t fired for keystrokes that
don??™t result in text being ???typed??? (for
example, it doesn??™t fire when you press
Ctrl, Shift, Backspace, the arrow keys, the
function keys, and so on).
Pages:
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336