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 此类创建附加事件的别名,以便 GotKeyboardFocus 在 ContentElement 继承为基元素时,它是类成员列表的一部分。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 | KeyboardFocusChangedEventHandler |
对应的隧道事件为 PreviewGotKeyboardFocus 。The corresponding tunneling event is PreviewGotKeyboardFocus.
重写 OnGotKeyboardFocus 以在派生类中实现此事件的类处理。Override OnGotKeyboardFocus to implement class handling for this event in derived classes.