Muokkaa

Jaa


Keyboard.PreviewLostKeyboardFocus Attached Event

Definition

Occurs when an element is in the process of losing keyboard focus.

see AddPreviewLostKeyboardFocusHandler, and RemovePreviewLostKeyboardFocusHandler
see AddPreviewLostKeyboardFocusHandler, and RemovePreviewLostKeyboardFocusHandler
see AddPreviewLostKeyboardFocusHandler, and RemovePreviewLostKeyboardFocusHandler

Remarks

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.

If the PreviewGotKeyboardFocus event or the PreviewLostKeyboardFocus event is handled, keyboard focus does not change.

Keyboard focus refers to the object that is receiving keyboard input. The element with keyboard focus has IsKeyboardFocused set to true. There can be only one element with keyboard focus on the entire desktop. Logical focus refers to the object within a focus scope that has focus. For more information on focus, keyboard focus, and logical focus, see Input Overview and Focus Overview.

Routed Event Information

Item Value
Identifier field PreviewLostKeyboardFocusEvent
Routing strategy Tunneling
Delegate KeyboardFocusChangedEventHandler

Applies to