Share via


UIElement.GettingFocus event

[This documentation is preliminary and is subject to change.]

Occurs immediately before the directional focus algorithm changes focus to this element. Apps can handle the event and set Handled to true in the event data; this will cancel the focus change.

Syntax

public event TypedEventHandler<UIElement, GettingFocusEventArgs> GettingFocus
Public Event GettingFocus As TypedEventHandler(Of UIElement, GettingFocusEventArgs)
public:
event TypedEventHandler<UIElement, GettingFocusEventArgs>^ GettingFocus {
   Windows::Foundation::EventRegistrationToken add(TypedEventHandler<UIElement, GettingFocusEventArgs>^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}

Event information

Delegate TypedEventHandler<UIElement, GettingFocusEventArgs>

Remarks

GettingFocus on the prospective target occurs before LosingFocus from the source, so it's the target element that has first chance to cancel the focus change (If that handler cancels, LosingFocus wouldn't fire at all.)

FocusManager provides APIs that can preview directional focus algorithm changes, based on FocusNavigationDirection.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml Windows::UI::Xaml [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

See also

UIElement

GettingFocusEventArgs

FocusManager