-
Notifications
You must be signed in to change notification settings - Fork 3
KeyboardShortcuts.RoutedEventKeyAction
Back to home | Back to Reference | View raw text
A key action that executes a routed event when activated.
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
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 |
Returns | Name |
---|---|
void |
Execute ()Activate this key action. |
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. |
A key action that executes a routed event when activated.
public RoutedEventKeyAction(RoutedEventHandler reh, string methodId, UIElement sourceElement)
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. |
Create a RoutedEventKeyAction.
public virtual void Execute()
Activate this key action.
public static KeyActionList CreateListFromMenu(Menu m)
Type | Name | Description |
---|---|---|
Menu |
m | The menu to load from. |
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.
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.
A list of key actions created from the menu passed in.
public static RoutedEventKeyAction CreateFromMenuItem(MenuItem mi)
Type | Name | Description |
---|---|---|
MenuItem |
mi | The menu item to use the Click event from. |
Generate a RoutedEventKeyAction using the Click event of a MenuItem. If the MenuItem doesn't have the Click event handled, an exception is thrown.
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. |
public virtual UIElement SourceElement { get; }
Gets the UI element that this action is related to, if any.
public virtual string ID { get; set; }
Get or set the unique ID associated with this key action.
Generated with ModularDoc