UIElement.OnAccessKey(AccessKeyEventArgs) UIElement.OnAccessKey(AccessKeyEventArgs) UIElement.OnAccessKey(AccessKeyEventArgs) UIElement.OnAccessKey(AccessKeyEventArgs) Method

定义

在调用对于此元素有意义的访问键时提供类处理。Provides class handling for when an access key that is meaningful for this element is invoked.

protected:
 virtual void OnAccessKey(System::Windows::Input::AccessKeyEventArgs ^ e);
protected virtual void OnAccessKey (System.Windows.Input.AccessKeyEventArgs e);
abstract member OnAccessKey : System.Windows.Input.AccessKeyEventArgs -> unit
override this.OnAccessKey : System.Windows.Input.AccessKeyEventArgs -> unit
Protected Overridable Sub OnAccessKey (e As AccessKeyEventArgs)

参数

e
AccessKeyEventArgs AccessKeyEventArgs AccessKeyEventArgs AccessKeyEventArgs

访问键事件的事件数据。The event data to the access key event. 事件数据报告哪个键被调用,并指示控制发送这些事件的 AccessKeyManager 对象是否也将此访问键调用发送到其他元素。The event data reports which key was invoked, and indicate whether the AccessKeyManager object that controls the sending of these events also sent this access key invocation to other elements.

注解

UIElement类或其他地方没有实际的 AccessKey 事件, 您可以引发或附加的处理程序。There is no actual AccessKey event in the UIElement class, or elsewhere, which you can raise or attach handlers for. 相反, 该事件是通过一个专用的管理器类AccessKeyManager产生的, 后者将对所有输入进行后处理, 以搜索适用于整个输入模型的访问密钥。Instead, the event is originated via a dedicated manager class, AccessKeyManager, which post-processes all input to search for access keys that are applicable to the entire input model.

继承者说明

此方法UIElement的默认实现将键盘焦点设置到此元素 (通过调用Focus())。The default implementation of this method in UIElement sets keyboard focus to this element (by calling Focus()). 如果实现可获得焦点, 则实现应保持此行为, 因为它是辅助功能方案的预期行为。Implementations should perpetuate this behavior if they are focusable, because it is an expected behavior for accessibility scenarios. 请注意, 基实现对传递的事件数据不执行任何操作, 并且不会引发进一步的事件;它只是设置焦点。Note that the base implementation does nothing with the passed event data and raises no further event; it just sets the focus.

适用于