UIElement.GotKeyboardFocus UIElement.GotKeyboardFocus UIElement.GotKeyboardFocus UIElement.GotKeyboardFocus Event


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

 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附加事件,此類別,讓GotKeyboardFocus屬於類別的成員清單時UIElement繼承為基底的項目。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 UIElement 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