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

定義

當叫用對這個項目有意義的便捷鍵 (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 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.

適用於