UIElement.PreviewGotKeyboardFocus 事件


在此元素聚焦于键盘时发生。Occurs when the keyboard is focused on this element.

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



由于此事件使用隧道路由,因此具有焦点的元素可以是子元素,而不是实际附加事件处理程序的元素。Because this event uses tunneling 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.PreviewGotKeyboardFocus 附加事件的别名,以便在将 UIElement 作为基元素继承时,PreviewGotKeyboardFocus 是类成员列表的一部分。This event creates an alias for the Keyboard.PreviewGotKeyboardFocus attached event for this class, so that PreviewGotKeyboardFocus is part of the class members list when UIElement is inherited as a base element. 附加到 PreviewGotKeyboardFocus 事件的事件处理程序附加到基础 Keyboard.PreviewGotKeyboardFocus 附加事件,并接收相同的事件数据实例。Event handlers that are attached to the PreviewGotKeyboardFocus event are attached to the underlying Keyboard.PreviewGotKeyboardFocus attached event and receive the same event data instance.

路由事件信息Routed Event Information

标识符字段Identifier field PreviewGotKeyboardFocusEvent
路由策略Routing strategy 隧道Tunneling
委托Delegate KeyboardFocusChangedEventHandler