Skip to content

Latest commit

 

History

History
48 lines (28 loc) · 2.58 KB

focusmanagerlostfocuseventargs_correlationid.md

File metadata and controls

48 lines (28 loc) · 2.58 KB
-api-id -api-type
P:Microsoft.UI.Xaml.Input.FocusManagerLostFocusEventArgs.CorrelationId
winrt property

Microsoft.UI.Xaml.Input.FocusManagerLostFocusEventArgs.CorrelationId

-description

Gets the unique ID generated when a focus movement event is initiated.

-property-value

The unique ID, if any. Otherwise, null.

The default is null.

-remarks

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

Focus moves can result in a number of direct and indirect actions.

For example, there is the standard sequence of events that starts with LosingFocus and moves through LostFocus, GettingFocus, to GotFocus. These focus events typically get routed through multiple elements in the element tree (including the FocusManager).

In some cases, the focus event can also get re-routed. For example, if the target element is not valid for some reason, you might call TrySetNewFocusedElement from the LosingFocus event to re-target focus to another element.

In other cases, you might need to cancel a focus change from one of your focus event handlers.

In addition, because focus events are raised asynchronously, focus might change again before a previous focus event has finished executing.

Each time a focus event is initiated, a unique CorrelationId is generated to help you track a focus event throughout these focus actions.

A new CorrelationId is generated when:

-see-also

FocusManagerGotFocusEventArgs.CorrelationId, Keyboard interactions, Focus navigation for keyboard, gamepad, remote control, and accessibility tools, Programmatic focus navigation

-examples