FocusManager.SetIsFocusScope(DependencyObject, Boolean) Method

Definition

Sets the specified DependencyObject as a focus scope.

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)

Parameters

element
DependencyObject

The element to make a focus scope.

value
Boolean

true if element is a focus scope; otherwise, false.

Examples

The follow example makes an element a focus scope by using SetIsFocusScope.

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

Remarks

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