Control.IsFocusEngaged 屬性

定義

取得或設定值,這個值表示焦點是否限制在遊戲台/遠端互動 (的控制界限內) 。

public:
 property bool IsFocusEngaged { bool get(); void set(bool value); };
bool IsFocusEngaged();

void IsFocusEngaged(bool value);
public bool IsFocusEngaged { get; set; }
var boolean = control.isFocusEngaged;
control.isFocusEngaged = boolean;
Public Property IsFocusEngaged As Boolean
<control IsFocusEngaged="bool"/>

屬性值

Boolean

bool

如果焦點在控制界限內受到限制,則為true;否則為false

Windows 需求

裝置系列
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)

備註

IsFocusEngagementEnabled 必須是 true ,而且控制項必須有焦點,才能將 IsFocusEngaged 屬性設定為 true。 否則,會發生執行時間例外狀況。

焦點參與可讓您更輕鬆地使用遊戲台或遙控器來與應用程式互動。 設定焦點參與不會影響鍵盤或其他輸入裝置。

IsFocusEngagementEnabled 屬性設定為 true時,它會將控制項標示為需要焦點參與。 這表示,使用者必須按下 \[A/選取\] 按鈕來「佔住」控制項並與它互動。 完成時,他們可以按 B/上一頁按鈕來解除控制項並離開控制項。

如需此屬性的詳細資訊,請參閱Xbox 和電視設計一文的焦點參與一節。

版本相容性

IsFocusEngaged 屬性在 Windows 10 1607 版之前無法使用。 如果您的應用程式在 Microsoft Visual Studio 中的「最低平臺版本」設定小於此頁面稍後需求區塊中顯示的「引進版本」,您必須設計和測試您的應用程式以考慮此專案。 如需詳細資訊,請參閱 版本調適型程式碼

若要避免在舊版Windows 10上執行您的應用程式時發生例外狀況,請勿在 XAML 中設定此屬性,或在不執行執行時間檢查的情況下使用它。 此範例示範如何使用 ApiInformation 類別來檢查此屬性是否存在,再加以設定。

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

適用於