Control.FocusDisengaged Event

Definition

Occurs when focus is released from the control boundaries (for game pad/remote interaction).

Equivalent WinUI event: Microsoft.UI.Xaml.Controls.Control.FocusDisengaged.

// Register
event_token FocusDisengaged(TypedEventHandler<Control, FocusDisengagedEventArgs const &> const& handler) const;

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

// Revoke with event_revoker
FocusDisengaged_revoker FocusDisengaged(auto_revoke_t, TypedEventHandler<Control, FocusDisengagedEventArgs const &> const& handler) const;
public event TypedEventHandler<Control,FocusDisengagedEventArgs> FocusDisengaged;
function onFocusDisengaged(eventArgs) { /* Your code */ }
control.addEventListener("focusdisengaged", onFocusDisengaged);
control.removeEventListener("focusdisengaged", onFocusDisengaged);
- or -
control.onfocusdisengaged = onFocusDisengaged;
Public Custom Event FocusDisengaged As TypedEventHandler(Of Control, FocusDisengagedEventArgs) 
<control FocusDisengaged="eventhandler"/>

Event Type

TypedEventHandler<Control,FocusDisengagedEventArgs>

Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

For event data, see FocusDisengagedEventArgs.

Focus engagement makes it easier to use a game pad or remote control to interact with an app. Setting focus engagement does not affect keyboard or other input devices.

When the IsFocusEngagementEnabled property is set to true, it marks the control as requiring focus engagement. This means that the user must press the A/Select button to "engage" the control and interact with it. When they are finished, they can press the B/Back button to disengage the control and navigate away from it.

For more info, see the Focus engagement section of the Designing for Xbox and TV article.

Version compatibility

The FocusDisengaged event is not available prior to Windows 10, version 1607. If your app’s 'minimum platform version' setting in Microsoft Visual Studio is less than the 'introduced version' shown in the Requirements block later in this page, you must design and test your app to account for this. For more info, see Version adaptive code.

To avoid exceptions when your app runs on previous versions of Windows 10, do not connect this event without first performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this event before you use it.

<Slider x:Name="slider1" Loaded="Slider_Loaded"/>
private void Slider_Loaded(object sender, RoutedEventArgs e)
{
    if (ApiInformation.IsEventPresent("Windows.UI.Xaml.Controls.Control", "FocusDisengaged"))
    {
        slider1.FocusDisengaged += Slider1_FocusDisengaged;
    }
}

Applies to