ContentElement.GotKeyboardFocus 事件

定義

鍵盤以此元素為焦點時發生。Occurs when the keyboard is focused on this element.

public:
 virtual event System::Windows::Input::KeyboardFocusChangedEventHandler ^ GotKeyboardFocus;
public event System.Windows.Input.KeyboardFocusChangedEventHandler GotKeyboardFocus;
member this.GotKeyboardFocus : System.Windows.Input.KeyboardFocusChangedEventHandler 
Public Custom Event GotKeyboardFocus As KeyboardFocusChangedEventHandler 

實作

備註

IsKeyboardFocusedChanged 是一個類似的事件,它會追蹤屬性中維護元素焦點狀態的狀態變更;在許多相同的情況下,都會引發 GotKeyboardFocus 事件。IsKeyboardFocusedChanged is a similar event that tracks status changes in a property that maintains the focus state for an element; the GotKeyboardFocus event is raised in many of the same circumstances.

因為此事件使用反升路由,所以具有焦點的元素可能是子項目,而不是實際附加事件處理常式的專案。Because this event uses bubbling routing, the element that has focus might be a child element instead of the element where the event handler is actually attached. 檢查事件資料中的 Source,以判斷具有焦點的實際元素。Check the Source in the event data to determine the actual element that has focus.

這個事件會為這個類別建立 Keyboard.GotKeyboardFocus 附加事件的別名,因此當 ContentElement 繼承為基底專案時,GotKeyboardFocus 就會是類別成員清單的一部分。This event creates an alias for the Keyboard.GotKeyboardFocus attached event for this class so that GotKeyboardFocus is part of the class members list when ContentElement is inherited as a base element. 附加至 GotKeyboardFocus 事件的事件處理常式會附加至基礎 Keyboard.GotKeyboardFocus 附加事件,並接收相同的事件資料實例。Event handlers that are attached to the GotKeyboardFocus event are attached to the underlying Keyboard.GotKeyboardFocus attached event and receive the same event data instance.

路由事件資訊Routed Event Information

識別碼欄位Identifier field GotKeyboardFocusEvent
路由策略Routing strategy 路由Bubbling
Delegate - 委派Delegate KeyboardFocusChangedEventHandler

適用於

另請參閱