इसके माध्यम से साझा किया गया


UIElement.GettingFocus Event

Definition

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

// Register
event_token GettingFocus(TypedEventHandler<UIElement, GettingFocusEventArgs const&> const& handler) const;

// Revoke with event_token
void GettingFocus(event_token const* cookie) const;

// Revoke with event_revoker
UIElement::GettingFocus_revoker GettingFocus(auto_revoke_t, TypedEventHandler<UIElement, GettingFocusEventArgs const&> const& handler) const;
public event TypedEventHandler<UIElement,GettingFocusEventArgs> GettingFocus;
function onGettingFocus(eventArgs) { /* Your code */ }
uIElement.addEventListener("gettingfocus", onGettingFocus);
uIElement.removeEventListener("gettingfocus", onGettingFocus);
- or -
uIElement.ongettingfocus = onGettingFocus;
Public Custom Event GettingFocus As TypedEventHandler(Of UIElement, GettingFocusEventArgs) 
<uiElement GettingFocus="eventhandler"/>

Event Type

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)

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.

Applies to

See also