Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.79 KB

control_onkeydown_1048103922.md

File metadata and controls

27 lines (18 loc) · 1.79 KB
-api-id -api-type
M:Windows.UI.Xaml.Controls.Control.OnKeyDown(Windows.UI.Xaml.Input.KeyRoutedEventArgs)
winrt method

Windows.UI.Xaml.Controls.Control.OnKeyDown

-description

Called before the KeyDown event occurs.

-parameters

-param e

The data for the event.

-remarks

As it's implemented directly on Control, OnKeyDown has an empty implementation. But each ancestor in a control's hierarchy may have provided an implementation. You won't be able to see this implementation because it's internal native code. In some cases a control will already have existing OnEvent overrides that mark the event Handled. For key events, controls are usually only handling for certain keys, by checking values in KeyRoutedEventArgs. For example, ButtonBase detects the Space key as a way to fire Click. Control code or your code probably shouldn't be suppressing all key events, because it's a common pattern to let key events bubble to the root visual so that they can be shortcuts or accelerators for app interaction. For more info see Keyboard interactions.

-examples

-see-also

UIElement.KeyDown, KeyRoutedEventArgs, Keyboard interactions, Events and routed events overview