Edit

Share via


FocusManager.GetFocusScope(DependencyObject) Method

Definition

Determines the closest ancestor of the specified element that has IsFocusScope set to true.

public:
 static System::Windows::DependencyObject ^ GetFocusScope(System::Windows::DependencyObject ^ element);
public static System.Windows.DependencyObject GetFocusScope (System.Windows.DependencyObject element);
static member GetFocusScope : System.Windows.DependencyObject -> System.Windows.DependencyObject
Public Shared Function GetFocusScope (element As DependencyObject) As DependencyObject

Parameters

element
DependencyObject

The element to get the closest focus scope for.

Returns

The focus scope for the specified element.

Exceptions

element is null.

Remarks

The default value of IsFocusScope on a Window, Menu, ToolBar, ContextMenu is true.

A focus scope is a container element that keeps track of the FocusManager.FocusedElement within its scope. By default, the Window class is a focus scope as are the Menu, ContextMenu, and ToolBar classes. An element that is a focus scope has IsFocusScope set to true.

For more information on focus, keyboard focus, and logical focus, see the Input Overview.

Applies to