Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

KeyboardAccelerator.Invoked Event

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Occurs when the key combination for this KeyboardAccelerator is pressed.

// 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
KeyboardAccelerator::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

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.

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

See also


Feedback

Was this page helpful?