Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Keyboard Class
 PreviewKeyDown Attached Event
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Keyboard..::.PreviewKeyDown Attached Event

Occurs when a key on the keyboard is pressed.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Visual Basic (Declaration)
See AddPreviewKeyDownHandler, RemovePreviewKeyDownHandler
Visual Basic (Usage)
See AddPreviewKeyDownHandler, RemovePreviewKeyDownHandler
C#
See AddPreviewKeyDownHandler, RemovePreviewKeyDownHandler
Visual C++
See AddPreviewKeyDownHandler, RemovePreviewKeyDownHandler
JScript
See AddPreviewKeyDownHandler, RemovePreviewKeyDownHandler
XAML Attribute Usage
<object Keyboard.PreviewKeyDown="KeyEventHandler" .../>

Identifier field

PreviewKeyDownEvent

Routing strategy

Tunneling

Delegate

KeyEventHandler

  • The corresponding bubbling event is KeyDown.

This is an attached event. WPF implements attached events as routed events. Attached events are fundamentally a XAML language concept for referencing events that can be handled on objects that do not define that event, which WPF expands upon by also enabling the event to traverse a route. Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, you use a designated Add*Handler method. For details, see Attached Events Overview.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker