UIElement.OnAccessKey(AccessKeyEventArgs) 方法

定義

當叫用對這個項目有意義的便捷鍵 (Access Key) 時,為其提供類別處理。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

便捷鍵事件的事件資料。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.

備註

類別或其他地方沒有實際的 AccessKey 事件 UIElement ,您可以為其引發或附加處理常式。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.

適用於