KeyboardAccelerator.Invoked Event


Occurs when the key combination for this KeyboardAccelerator is pressed.

Equivalent WinUI event: Microsoft.UI.Xaml.Input.KeyboardAccelerator.Invoked.

// Register
event_token Invoked(TypedEventHandler<KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs const &> const& handler) const;

// Revoke with event_token
void Invoked(event_token const* cookie) const;

// Revoke with event_revoker
Invoked_revoker Invoked(auto_revoke_t, TypedEventHandler<KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs const &> const& handler) const;
public event TypedEventHandler<KeyboardAccelerator,KeyboardAcceleratorInvokedEventArgs> Invoked;
function onInvoked(eventArgs) { /* Your code */ }
keyboardAccelerator.addEventListener("invoked", onInvoked);
keyboardAccelerator.removeEventListener("invoked", onInvoked);
- or -
keyboardAccelerator.oninvoked = onInvoked;
Public Custom Event Invoked As TypedEventHandler(Of KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs) 

Event Type



This example shows how to override the "Select all" command (Ctrl+A keyboard accelerator) in a custom ListView control. We also set the Handled property to true to stop the event bubbling further.

public class MyListView : ListView
  protected override void OnKeyboardAcceleratorInvoked(KeyboardAcceleratorInvokedEventArgs args) 
    if(args.KeyboardAccelerator.Key == VirtualKey.A 
      && args.KeyboardAccelerator.Modifiers == VirtualKeyModifiers.Control)
      args.Handled = true;


Handle this event to override the default KeyboardAccelerator behavior.

Applies to

See also