Skip to main content

ActionBase.Shortcut Property

Defines the keyboard shortcut that executes the current Action.

Namespace: DevExpress.ExpressApp.Actions

Assembly: DevExpress.ExpressApp.v26.1.dll

Declaration

[DefaultValue(null)]
public string Shortcut { get; set; }

Property Value

Type Default Description
String null

The current Action’s shortcut.

Remarks

Use this property to assign shortcuts for Actions in code.

The Application Model uses the ActionBase.Shortcut value as the default value for the IModelAction.Shortcut property. You can override it in the ActionDesign | Actions | <Action> node of the Model Editor.

Windows Forms

You can use the following values with the Shortcut property in WinForms applications:

  • A System.Windows.Forms.Shortcut enumeration value in string format.

    public class ShortcutController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
            Frame.GetController<NewObjectViewController>().NewObjectAction.Shortcut = "CtrlL";
            // ...
    
  • A System.Windows.Forms.Keys enumeration value in string format.

    public class ShortcutController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
            Frame.GetController<NewObjectViewController>().NewObjectAction.Shortcut = "Pause";
            // ...
    
  • Several System.Windows.Forms.Keys values in string format separated by plus sign (+).

    public class ShortcutController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
            Frame.GetController<NewObjectViewController>().NewObjectAction.Shortcut = "Control+L";
            // ...
    

Note

XAF Windows Forms applications do not support multiple shortcuts for a single Action.

ASP.NET Core Blazor

In XAF ASP.NET Core Blazor applications, shortcuts are available for Actions that appear as Toolbar items and Grid Row Context Menu items.

XAF ASP.NET Core Blazor applications support most of the Windows Forms syntax, but we recommend setting shortcuts in ASP.NET Core Blazor applications as follows:

public class ShortcutController : ViewController {
  protected override void OnActivated() {
    base.OnActivated();
    Frame.GetController<NewObjectViewController>().NewObjectAction.Shortcut = "Control+Shift+Alt+Windows+N";
    Frame.GetController<DeleteObjectsViewController>().DeleteAction.Shortcut = "Control+Shift+PageDown";
    Frame.GetController<CloneObjectViewController>().CloneObjectAction.Shortcut = "Control+O;Command+O";
    // ...

For specific code values (for example, Period, Comma, or Slash), refer to the following list: Code values for keyboard events (MDN)

Note

XAF ASP.NET Core Blazor applications support multiple shortcuts for a single Action. Use semicolons to separate individual shortcuts. Semicolons cannot be part of a shortcut.

Default Shortcuts

The following table contains default shortcuts you can use to execute Actions in XAF ASP.NET Core Blazor and Windows Forms applications:

Action Blazor Shortcut WinForms Shortcut
Delete Ctrl+Delete Ctrl+D
New Ctrl+Shift+A Ctrl+N
Refresh Ctrl+Shift+R F5
Save Ctrl+Shift+S Ctrl+S
SaveAndClose Ctrl+Shift+Enter Ctrl+Enter
NextObject Ctrl+Alt+Right Arrow Ctrl+Page Down
PreviousObject Ctrl+Alt+Left Arrow Ctrl+Page Up
NavigateBack Alt+Left Arrow Alt+Left Arrow
NavigateForward Alt+Right Arrow Alt+Right Arrow
CloseThisTabAction Ctrl+Alt+X
Command+Alt+X
DialogOK Ctrl+Shift+Enter
Logon Enter
CopyCellValue Ctrl+Shift+C
EditModel Ctrl+Shift+F1
OpenObject Ctrl+Shift+O
Print Ctrl+P
Open (File Attachments module) Ctrl+O
SaveTo (File Attachments module) Ctrl+Shift+S
See Also