Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 2.56 KB

uielement_gettingfocus.md

File metadata and controls

38 lines (23 loc) · 2.56 KB
-api-id -api-type
E:Microsoft.UI.Xaml.UIElement.GettingFocus
winrt event

Microsoft.UI.Xaml.UIElement.GettingFocus

-description

Occurs before a UIElement receives focus. This event is raised synchronously to ensure focus isn't moved while the event is bubbling.

-xaml-syntax

<uiElement GettingFocus="eventhandler"/>

-remarks

We recommend using the UIElement focus routed events instead of FocusManager events whenever possible.

Only a single UI element at a time can have focus.

A control can get focus when another control loses focus, the application view changes, the user switches applications, or the user interacts with the system such that the application is no longer in the foreground.

When programmatically navigating between elements, FocusNavigationDirection.Previous and FocusNavigationDirection.Next cannot be used with FindNextElementOptions. Only FocusNavigationDirection.Up, FocusNavigationDirection.Down, FocusNavigationDirection.Left, or FocusNavigationDirection.Right are valid.

GettingFocus is a routed event. For more info on the routed event concept, see Events and routed events overview.

-see-also

GettingFocusEventArgs, GotFocus, LostFocus, LosingFocusEvent, LosingFocus, UIElement.Focus(Microsoft.UI.Xaml.FocusState), AddHandler, Events and routed events overview, Keyboard interactions, Focus navigation for keyboard, gamepad, remote control, and accessibility tools, Programmatic focus navigation

-examples