Skip to content

KeyboardShortcuts.RoutedEventKeyAction

JaykeBird edited this page Feb 21, 2023 · 6 revisions

Back to home | Back to Reference | View raw text

RoutedEventKeyAction class

Description

A key action that executes a routed event when activated.

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi.KeyboardShortcuts
  SolidShineUi.KeyboardShortcuts.RoutedEventKeyAction[[RoutedEventKeyAction]]
  SolidShineUi.KeyboardShortcuts.IKeyAction[[IKeyAction]]
  class SolidShineUi.KeyboardShortcuts.IKeyAction interfaceStyle;
  end
SolidShineUi.KeyboardShortcuts.IKeyAction --> SolidShineUi.KeyboardShortcuts.RoutedEventKeyAction
Loading

Members

Properties

Public properties

Type Name Methods
string ID
Get or set the unique ID associated with this key action.
get, set
UIElement SourceElement
Gets the UI element that this action is related to, if any.
get

Methods

Public methods

Returns Name
void Execute()
Activate this key action.

Public Static methods

Returns Name
RoutedEventKeyAction CreateFromMenuItem(MenuItem mi)
Generate a RoutedEventKeyAction using the Click event of a MenuItem. If the MenuItem doesn't have the Click event handled, an exception is thrown.
KeyActionList CreateListFromMenu(Menu m)
Create a list of key actions from all the menu items in a particular menu. Each menu item with a name and Click event handler will be added to this list.

Details

Summary

A key action that executes a routed event when activated.

Inheritance

Constructors

RoutedEventKeyAction

public RoutedEventKeyAction(RoutedEventHandler reh, string methodId, UIElement sourceElement)
Arguments
Type Name Description
RoutedEventHandler reh The RoutedEventHandler to invoke when this key action is activated.
string methodId The unique ID to associate with this key action.
UIElement sourceElement The UI element, if any, associated with this RoutedEventHandler. For example, it could be a menu item or button that would alternatively invoke this routed event handler.
Summary

Create a RoutedEventKeyAction.

Methods

Execute

public virtual void Execute()
Summary

Activate this key action.

CreateListFromMenu

public static KeyActionList CreateListFromMenu(Menu m)
Arguments
Type Name Description
Menu m The menu to load from.
Summary

Create a list of key actions from all the menu items in a particular menu. Each menu item with a name and Click event handler will be added to this list.

Remarks

No exceptions are thrown from this method; a blank list is returned if no menu items could be added. Each menu item should have a name (via the Name or x:Name properties). If multiple menu items do not have a name, then only the first one encountered will be added to the list.

Returns

A list of key actions created from the menu passed in.

CreateFromMenuItem

public static RoutedEventKeyAction CreateFromMenuItem(MenuItem mi)
Arguments
Type Name Description
MenuItem mi The menu item to use the Click event from.
Summary

Generate a RoutedEventKeyAction using the Click event of a MenuItem. If the MenuItem doesn't have the Click event handled, an exception is thrown.

Exceptions
Name Description
MissingMethodException Thrown if the MenuItem does not have any Click event handlers.
InvalidOperationException Thrown if there was an issue entering into the MenuItem via reflection. If this error occurs, please contact the library creator.
ArgumentNullException Thrown if the MenuItem is null.

Properties

SourceElement

public virtual UIElement SourceElement { get; }
Summary

Gets the UI element that this action is related to, if any.

ID

public virtual string ID { get; set; }
Summary

Get or set the unique ID associated with this key action.

Generated with ModularDoc

Clone this wiki locally