|
22 | 22 | ## Remarks
|
23 | 23 | In Windows Presentation Foundation (WPF) there are two concepts concerning focus: keyboard focus and logical focus.
|
24 | 24 |
|
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. |
26 | 26 |
|
27 | 27 | Logical focus pertains to the <xref:System.Windows.Input.FocusManager.FocusedElement%2A?displayProperty=nameWithType> within a specific focus scope.
|
28 | 28 |
|
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`. |
30 | 30 |
|
31 | 31 | 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>.
|
32 | 32 |
|
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. |
34 | 34 |
|
35 | 35 | 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`.
|
36 | 36 |
|
|
110 | 110 | <format type="text/markdown"><. |
| 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). |
114 | 114 |
|
115 | 115 | <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.
|
116 | 116 |
|
|
182 | 182 | <Parameter Name="element" Type="System.Windows.DependencyObject" />
|
183 | 183 | </Parameters>
|
184 | 184 | <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> |
186 | 186 | <summary>Gets the element with logical focus within the specified focus scope.</summary>
|
187 | 187 | <returns>The element in the specified focus scope with logical focus.</returns>
|
188 | 188 | <remarks>
|
189 | 189 | <format type="text/markdown"><. |
| 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). |
193 | 195 |
|
194 | 196 | If `element` is not a focus scope, this method will return `null`.
|
195 | 197 |
|
|
238 | 240 | ## Remarks
|
239 | 241 | 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`.
|
240 | 242 |
|
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`. |
242 | 244 |
|
243 | 245 | For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
|
244 | 246 |
|
|
276 | 278 | <format type="text/markdown"><.
|
282 | 284 |
|
|
339 | 341 | <format type="text/markdown"><.
|
345 | 347 |
|
|
386 | 388 | ## Remarks
|
387 | 389 | 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`.
|
388 | 390 |
|
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`. |
390 | 392 |
|
391 | 393 | For more information on focus, keyboard focus, and logical focus, see the [Input Overview](~/docs/framework/wpf/advanced/input-overview.md).
|
392 | 394 |
|
|
511 | 513 | <format type="text/markdown"><. |
| 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). |
515 | 517 |
|
516 | 518 | 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.
|
517 | 519 |
|
|
558 | 560 | <format type="text/markdown"><.
|
564 | 566 |
|
|
0 commit comments