Skip to content

Latest commit

 

History

History
53 lines (32 loc) · 2.38 KB

control_isfocusengaged.md

File metadata and controls

53 lines (32 loc) · 2.38 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.Control.IsFocusEngaged
winrt property

Windows.UI.Xaml.Controls.Control.IsFocusEngaged

-description

Get or sets a value that indicates whether focus is constrained within the control boundaries (for game pad/remote interaction).

-xaml-syntax

<control IsFocusEngaged="bool"/>

-property-value

true if focus is constrained within the control boundaries; otherwise, false.

-remarks

IsFocusEngagementEnabled must be true and the control must have focus before you set the IsFocusEngaged property to true. Otherwise, a runtime exception will occur.

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 about this property, see the Focus engagement section of the Designing for Xbox and TV article.

Version compatibility

The IsFocusEngaged property 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 set this property in XAML or use it without performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this property before you set it.

if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.Control", "IsFocusEngaged"))
{
    slider1.IsFocusEngaged = true;
}

-examples

-see-also