UIElement.IsKeyboardFocused 屬性

定義

取得值,指出這個項目是否具有鍵盤焦點。Gets a value indicating whether this element has keyboard focus. 這是相依性屬性。This is a dependency property.

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

屬性值

Boolean

如果這個項目具有鍵盤焦點,則為 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

適用於

另請參閱