FocusManager.SetIsFocusScope(DependencyObject, Boolean) 方法

定義

將指定的 DependencyObject 設定為焦點範圍。

public:
 static void SetIsFocusScope(System::Windows::DependencyObject ^ element, bool value);
public static void SetIsFocusScope (System.Windows.DependencyObject element, bool value);
static member SetIsFocusScope : System.Windows.DependencyObject * bool -> unit
Public Shared Sub SetIsFocusScope (element As DependencyObject, value As Boolean)

參數

element
DependencyObject

要成為焦點範圍的項目。

value
Boolean

如果 element 為焦點範圍,則為 true,否則為 false

範例

下列範例會使用 SetIsFocusScope讓專案成為焦點範圍。

StackPanel focuseScope2 = new StackPanel();
FocusManager.SetIsFocusScope(focuseScope2, true);
Dim focuseScope2 As New StackPanel()
FocusManager.SetIsFocusScope(focuseScope2, True)

備註

焦點範圍是可追蹤其範圍內 之的 FocusManager.FocusedElement 容器專案。 根據預設,類別 Window 是焦點範圍,如同 MenuContextMenuToolBar 類別。 焦點範圍的項目已 IsFocusScope 設定為 true

如需焦點、鍵盤焦點和邏輯焦點的詳細資訊,請參閱 輸入概觀

適用於