UIElement.GettingFocus Evento

Definición

Se produce antes de que un UIElement reciba el foco. Este evento se genera de forma sincrónica para asegurarse de que el foco no se mueve mientras el evento se propaga.

// 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"/>

Tipo de evento

Comentarios

Se recomienda usar los eventos enrutados de foco UIElement en lugar de los eventos focusManager siempre que sea posible.

Solo un único elemento de interfaz de usuario a la vez puede tener el foco.

Un control puede obtener el foco cuando otro control pierde el foco, cambia la vista de la aplicación, cambia las aplicaciones del usuario o el usuario interactúa con el sistema para que la aplicación ya no esté en primer plano.

Al navegar mediante programación entre elementos, FocusNavigationDirection.Previous y FocusNavigationDirection.Next no se pueden usar con FindNextElementOptions. Solo FocusNavigationDirection.Up, FocusNavigationDirection.Down, FocusNavigationDirection.Left o FocusNavigationDirection.Right son válidos.

GettingFocus es un evento enrutado. Para obtener más información sobre el concepto de evento enrutado, consulta Información general sobre eventos y eventos enrutados.

Se aplica a

Consulte también