FocusManager.SetIsFocusScope(DependencyObject, Boolean) Method

Definition

Sets the specified DependencyObject as a focus scope.

C#
public static void SetIsFocusScope(System.Windows.DependencyObject element, bool value);

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.

C#
StackPanel focuseScope2 = 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

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10