FocusManager.FocusedElement 附加属性

定义

确定此属性附加到的元素是否具有逻辑焦点。Determines whether the element this property is attached to has logical focus.

see GetFocusedElement, and SetFocusedElement
see GetFocusedElement, and SetFocusedElement
see GetFocusedElement, and SetFocusedElement

示例

下面的示例演示如何使成为 Button 焦点元素。The following example shows how to make a Button the focused element.

<StackPanel FocusManager.FocusedElement="{Binding ElementName=firstButton}">
  <Button Name="firstButton" />
</StackPanel>

注解

FocusedElement是对特定焦点范围具有逻辑焦点的元素。The FocusedElement 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.

GetFocusedElementSetFocusedElement 可用于获取和设置指定焦点范围内的聚焦元素。GetFocusedElement and SetFocusedElement can be used to get and set the focused element within the specified focus scope.

依赖项属性信息Dependency Property Information

标识符字段Identifier field FocusedElementProperty
元数据属性设置为 trueMetadata properties set to true None

适用于