UIElement.IsKeyboardFocused Property


获取一个值,该值表示该元素是否具有键盘焦点。Gets a value indicating whether this element has keyboard focus. 这是依赖项属性。This is a dependency property.

 property bool IsKeyboardFocused { bool get(); };
public bool IsKeyboardFocused { get; }
member this.IsKeyboardFocused : bool
Public ReadOnly Property IsKeyboardFocused As Boolean

Property Value


如果此元素具有键盘焦点,则为 true;否则为 falsetrue if this element has keyboard focus; otherwise, false. 默认值为 falseThe default is false.



对此属性的确定值所做的更改可能伴随着与焦点相关的事件。Changes to the determined value of this property may be accompanied by focus-related events.

IsKeyboardFocusedIsKeyboardFocusWithin 通常用于其他与输入相关的事件的类事件处理程序中,例如,用于确定元素是否已具有键盘焦点,或在鼠标事件和键盘事件一起发生时做出决定。IsKeyboardFocused and IsKeyboardFocusWithin are commonly used within class event handlers for other input-related events, for instance to determine whether the element already has keyboard focus, or to make determinations when mouse events and keyboard events occur in conjunction.

依赖项属性信息Dependency Property Information

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

Applies to

See also