KeyboardAccelerator.Invoked Event

Definition

Occurs when the key combination for this KeyboardAccelerator is pressed.

C#
public event TypedEventHandler<KeyboardAccelerator,KeyboardAcceleratorInvokedEventArgs> Invoked;

Event Type

Examples

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.

C#
public class MyListView : ListView
{
  …
  protected override void OnKeyboardAcceleratorInvoked(KeyboardAcceleratorInvokedEventArgs args) 
  {
    if(args.KeyboardAccelerator.Key == VirtualKey.A 
      && args.KeyboardAccelerator.Modifiers == VirtualKeyModifiers.Control)
    {
      CustomSelectAll(TypeOfSelection.OnlyNumbers); 
      args.Handled = true;
    }
  }
  …
}

Remarks

Handle this event to override the default KeyboardAccelerator behavior.

Applies to

Product Versions
WinRT Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

See also