UIElement.IsKeyboardFocusWithin 屬性

定義

取得值,表示鍵盤焦點是否在項目或其視覺化樹狀結構子項目內的任何位置。Gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements. 這是相依性屬性。This is a dependency property.

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

屬性值

Boolean

如果鍵盤焦點在項目或其子項目上,則為 true;否則為 falsetrue if keyboard focus is on the element or its child elements; otherwise, false.

實作

備註

IsKeyboardFocusWithinChanged除非衍生的類別已覆寫來隱藏事件,否則這個屬性的值變更通常會引發事件 OnIsKeyboardFocusWithinChangedChanges to the value of this property typically raise the IsKeyboardFocusWithinChanged event, unless a derived class has overridden OnIsKeyboardFocusWithinChanged to suppress the event.

您不會直接設定這個屬性,但您可以藉由呼叫或提出要求,將焦點設定為專案 Focus MoveFocusYou do not set this property directly, but you can set the focus to an element by calling Focus, or by making a MoveFocus request. 其中一個方法呼叫可能會變更這個屬性值。Either of these method calls might change this property value.

IsKeyboardFocusedIsKeyboardFocusWithin 通常用於其他輸入相關事件的類別事件處理常式中,例如,用來判斷專案是否已經有鍵盤焦點,或在滑鼠事件和鍵盤事件一起發生時進行判斷。IsKeyboardFocused and IsKeyboardFocusWithin are typically 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 IsKeyboardFocusWithinProperty
中繼資料屬性設定為 trueMetadata properties set to true NoneNone

適用於