UIElement.LosingFocus Event
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
// Register
event_token LosingFocus(TypedEventHandler<UIElement, LosingFocusEventArgs const&> const& handler) const;
// Revoke with event_token
void LosingFocus(event_token const* cookie) const;
// Revoke with event_revoker
UIElement::LosingFocus_revoker LosingFocus(auto_revoke_t, TypedEventHandler<UIElement, LosingFocusEventArgs const&> const& handler) const;
public event TypedEventHandler<UIElement,LosingFocusEventArgs> LosingFocus;
function onLosingFocus(eventArgs) { /* Your code */ }
uIElement.addEventListener("losingfocus", onLosingFocus);
uIElement.removeEventListener("losingfocus", onLosingFocus);
- or -
uIElement.onlosingfocus = onLosingFocus;
Public Custom Event LosingFocus As TypedEventHandler(Of UIElement, LosingFocusEventArgs)
<uiElement LosingFocus="eventhandler"/>
Device family |
Windows 10 Creators Update (introduced in 10.0.15063.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v4.0)
|
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 lose focus when another control gets 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.
LosingFocus is a routed event. For more info on the routed event concept, see Events and routed events overview.
- LosingFocusEventArgs
- LostFocus
- LosingFocusEvent
- GotFocus
- GettingFocusEvent
- GettingFocus
- Focus(FocusState)
- AddHandler(RoutedEvent, Object, Boolean)
- Events and routed events overview
- Keyboard interactions
- Focus navigation for keyboard, gamepad, remote control, and accessibility tools
- Programmatic focus navigation