Skip to content

Commit 96bf121

Browse files
authored
Fix docs for FocusManager.GetFocusedElement (#3804)
* Fix docs for FocusManager.GetFocusScope * feedback
1 parent e8c7cc8 commit 96bf121

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

xml/System.Windows.Input/FocusManager.xml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
## Remarks
2323
In Windows Presentation Foundation (WPF) there are two concepts concerning focus: keyboard focus and logical focus.
2424
25-
Keyboard focus pertains to the element which is currently receiving keyboard input. There can be only one element with keyboard focus. This element with keyboard focus has <xref:System.Windows.IInputElement.IsKeyboardFocused%2A> set to `true`. <xref:System.Windows.Input.Keyboard.FocusedElement%2A?displayProperty=nameWithType> returns the element with keyboard focus.
25+
Keyboard focus pertains to the element that is currently receiving keyboard input. There can be only one element with keyboard focus. This element with keyboard focus has <xref:System.Windows.IInputElement.IsKeyboardFocused%2A> set to `true`. <xref:System.Windows.Input.Keyboard.FocusedElement%2A?displayProperty=nameWithType> returns the element with keyboard focus.
2626
2727
Logical focus pertains to the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within a specific focus scope.
2828
29-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
29+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
3030
3131
There can be multiple elements with logical focus, but there can only be one element with logical focus within a single focus scope. An element with logical focus does not necessarily have keyboard focus, but an element with keyboard focus will have logical focus. It is possible to define a focus scope within a focus scope. In this case, both the parent focus scope and the child focus scope can have a <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType>.
3232
33-
The following scenario illustrates how keyboard focus and logical focus change in a WPF application that has a <xref:System.Windows.Window> with a <xref:System.Windows.Controls.TextBox> and a <xref:System.Windows.Controls.Menu> which has a <xref:System.Windows.Controls.MenuItem>. When keyboard focus changes from the <xref:System.Windows.Controls.TextBox> to the <xref:System.Windows.Controls.MenuItem>, the <xref:System.Windows.Controls.TextBox> losses keyboard focus but retains logical focus for the <xref:System.Windows.Window> focus scope. The <xref:System.Windows.Controls.MenuItem> obtains keyboard focus and obtains logical focus for the <xref:System.Windows.Controls.Menu> focus scope. When keyboard focus returns to the root <xref:System.Windows.Window>, the element in <xref:System.Windows.Window> focus scope with logical focus will obtain keyboard focus, which in this case is the <xref:System.Windows.Controls.TextBox>. The <xref:System.Windows.Controls.TextBox> now has keyboard focus and logical focus. The <xref:System.Windows.Controls.MenuItem> loses keyboard focus, but retains logical focus for the <xref:System.Windows.Controls.Menu> focus scope.
33+
The following scenario illustrates how keyboard focus and logical focus change in a WPF application that has a <xref:System.Windows.Window> with a <xref:System.Windows.Controls.TextBox> and a <xref:System.Windows.Controls.Menu> that has a <xref:System.Windows.Controls.MenuItem>. When keyboard focus changes from the <xref:System.Windows.Controls.TextBox> to the <xref:System.Windows.Controls.MenuItem>, the <xref:System.Windows.Controls.TextBox> losses keyboard focus but retains logical focus for the <xref:System.Windows.Window> focus scope. The <xref:System.Windows.Controls.MenuItem> obtains keyboard focus and obtains logical focus for the <xref:System.Windows.Controls.Menu> focus scope. When keyboard focus returns to the root <xref:System.Windows.Window>, the element in <xref:System.Windows.Window> focus scope with logical focus will obtain keyboard focus, which in this case is the <xref:System.Windows.Controls.TextBox>. The <xref:System.Windows.Controls.TextBox> now has keyboard focus and logical focus. The <xref:System.Windows.Controls.MenuItem> loses keyboard focus, but retains logical focus for the <xref:System.Windows.Controls.Menu> focus scope.
3434
3535
The default value of <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> on a <xref:System.Windows.Window>, <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ToolBar>, and <xref:System.Windows.Controls.ContextMenu> is `true`.
3636
@@ -110,7 +110,7 @@
110110
<format type="text/markdown"><![CDATA[
111111
112112
## Remarks
113-
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element which has logical focus for a specific focus scope. This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
113+
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element that has logical focus for a specific focus scope. This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
114114
115115
<xref:System.Windows.Input.FocusManager.GetFocusedElement%2A> and <xref:System.Windows.Input.FocusManager.SetFocusedElement%2A> can be used to get and set the focused element within the specified focus scope.
116116
@@ -182,14 +182,16 @@
182182
<Parameter Name="element" Type="System.Windows.DependencyObject" />
183183
</Parameters>
184184
<Docs>
185-
<param name="element">The element with logical focus in the specified focus scope.</param>
185+
<param name="element">An element that is a focus scope.</param>
186186
<summary>Gets the element with logical focus within the specified focus scope.</summary>
187187
<returns>The element in the specified focus scope with logical focus.</returns>
188188
<remarks>
189189
<format type="text/markdown"><![CDATA[
190190
191191
## Remarks
192-
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element which has logical focus for a specific focus scope. This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
192+
193+
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element that has logical focus for a specific focus scope. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
194+
This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
193195
194196
If `element` is not a focus scope, this method will return `null`.
195197
@@ -238,7 +240,7 @@
238240
## Remarks
239241
The default value of <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> on a <xref:System.Windows.Window>, <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ToolBar>, <xref:System.Windows.Controls.ContextMenu> is `true`.
240242
241-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
243+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
242244
243245
For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
244246
@@ -276,7 +278,7 @@
276278
<format type="text/markdown"><![CDATA[
277279
278280
## Remarks
279-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
281+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
280282
281283
For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
282284
@@ -339,7 +341,7 @@
339341
<format type="text/markdown"><![CDATA[
340342
341343
## Remarks
342-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
344+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
343345
344346
For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
345347
@@ -386,7 +388,7 @@
386388
## Remarks
387389
The default value of <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> on a <xref:System.Windows.Window>, <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ToolBar>, <xref:System.Windows.Controls.ContextMenu> is `true`.
388390
389-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
391+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
390392
391393
For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
392394
@@ -511,7 +513,7 @@
511513
<format type="text/markdown"><![CDATA[
512514
513515
## Remarks
514-
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element which has logical focus for the specific focus scope. This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
516+
The <xref:System.Windows.Input.FocusManager.FocusedElement%2A> is the element that has logical focus for the specific focus scope. This object may or may not have keyboard focus. Keyboard focus refers to the element that receives keyboard input. For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
515517
516518
It is possible to specify a focus scope that is an ancestor of the focus scope the element is in. For example, if a <xref:System.Windows.Controls.StackPanel> is a focus scope and its parent <xref:System.Windows.Window> is a focus scope, a <xref:System.Windows.Controls.TextBox> child of the <xref:System.Windows.Controls.StackPanel> could specify the <xref:System.Windows.Window> as the focus scope when calling <xref:System.Windows.Input.FocusManager.SetFocusedElement%2A>. The <xref:System.Windows.Controls.TextBox> is then <xref:System.Windows.Input.FocusManager.FocusedElement%2A> for both the <xref:System.Windows.Window> focus scope and the <xref:System.Windows.Controls.StackPanel> focus scope.
517519
@@ -558,7 +560,7 @@
558560
<format type="text/markdown"><![CDATA[
559561
560562
## Remarks
561-
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element which is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
563+
A focus scope is a container element that keeps track of the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within its scope. By default, the <xref:System.Windows.Window> class is a focus scope as are the <xref:System.Windows.Controls.Menu>, <xref:System.Windows.Controls.ContextMenu>, and <xref:System.Windows.Controls.ToolBar> classes. An element that is a focus scope has <xref:System.Windows.Input.FocusManager.IsFocusScope%2A> set to `true`.
562564
563565
For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
564566

0 commit comments

Comments
 (0)