Skip to main content

Keyboard Shortcuts

  • 4 minutes to read

The ASPxScheduler supports keyboard shortcuts allowing an end-user to execute a command by pressing an associated key combination. This document lists predefined keyboard shortcuts and provides information on how you can provide custom shortcuts in your web applications.

The document consists of the following sections.

Predefined Shortcuts

The Scheduler control provides a set of predefined keyboard shortcuts, which are listed in the table below.

Shortcut Command Description
Up SchedulerShortcutCommands.NavigateUp Move selection up or select anappointment above depending on the selection mode.
Down SchedulerShortcutCommands.NavigateDown Move selection down or select an appointment below depending on the selection mode.
Left SchedulerShortcutCommands.NavigateLeft Move selection left or select an appointment to the left depending on the selection mode.
Right SchedulerShortcutCommands.NavigateRight Move selection right or select an appointment to the right depending on the selection mode.
Shift + Up SchedulerShortcutCommands.ExpandSelectionUp Expand the current selection up.
Shift + Down SchedulerShortcutCommands.ExpandSelectionDown Expand the current selection down.
Shift + Left SchedulerShortcutCommands.ExpandSelectionLeft Expand the current selection left.
Shift + Right SchedulerShortcutCommands.ExpandSelectionRight Expand the current selection right.
Ctrl + Left SchedulerShortcutCommands.BackwardVisibleInterval Navigate to the previous visible interval.
Ctrl + Right SchedulerShortcutCommands.ForwardVisibleInterval Navigate to the next visible interval.
Enter SchedulerShortcutCommands.EditAppointment Start editing the current appointment or create a new one.
Tab SchedulerShortcutCommands.ToggleSelection Toggle between cell and appointment selection.
Shift+D SchedulerShortcutCommands.SwitchToDayView Switch to the Day View.
Shift+E SchedulerShortcutCommands.SwitchToWorkWeekView Switch to the Work Week View.
Shift+F SchedulerShortcutCommands.SwitchToFullWeekView Switch to the Full Week View.
Shift+W SchedulerShortcutCommands.SwitchToWeekView Switch to the Week View.
Shift+M SchedulerShortcutCommands.SwitchToMonthView Switch to the Month View.
Shift+T SchedulerShortcutCommands.SwitchToTimelineView Switch to the Timeline View.
Shift+A SchedulerShortcutCommands.SwitchToAgendaView Switch to the Agenda View.
Ctrl+C SchedulerShortcutCommands.Copy Copy the selected appointment.
Ctrl+V SchedulerShortcutCommands.Paste Paste an appointment into the current cell.
Ctrl+X SchedulerShortcutCommands.Cut Cut the selected appointment.
Delete SchedulerShortcutCommands.DeleteShortcut Delete the selected appointment.

Create Custom Shortcuts

You can define custom keyboard shortcuts using the ASPxScheduler.CustomShortcuts collection property. To create a shortcut and associate it with custom client-side logic, do the following.

  1. Add a custom shortcut to the ASPxScheduler.CustomShortcuts collection.

    <dx:ASPxScheduler ID="ASPxScheduler1" ... >
        ...
        <CustomShortcuts>
            <dxwschs:SchedulerShortcut CommandName="customShortcut" Shortcut="shift+enter" />
        </CustomShortcuts>
    </dx:ASPxScheduler>
    

    At runtime, add a custom shortcut by passing a custom command name and key combination to the SchedulerCustomShortcutCollection.Add method.

    protected void Page_Load(object sender, EventArgs e) {
        ASPxScheduler1.CustomShortcuts.Add("customShortcut", "shift+enter");
    }
    
  2. Handle the client-side SchedulerClientSideEvents.Shortcut event. This event fires when an end-user presses a key combination associated with any shortcut contained in the ASPxScheduler.CustomShortcuts collection.

    <dx:ASPxScheduler ID="ASPxScheduler1" ... >
        ...
        <ClientSideEvents Shortcut="onShortcut"/>
    
        <CustomShortcuts> 
            <dxwschs:SchedulerShortcut CommandName="customShortcut" Shortcut="shift+enter" /> 
        </CustomShortcuts> 
    </dx:ASPxScheduler>
    
  3. In the event handler, use the ShortcutEventArgs.commandName property to determine which shortcut has been pressed.

    The code sample below demonstrates how to provide client-side logic to a custom shortcut.

    function onShortcut(scheduler, args) {
        if (args.commandName == "customShortcut") {
    
            // Your custom logic to process a keyboard shortcut.
    
            args.handled = true;
        }
    }
    

Customize Predefined Shortcuts

You can override any predefined shortcut with a custom one, which is useful if you want to assign a custom command to one of the predefined shortcuts. To override an existing shortcut, declare a custom shortcut with the same key combination.

<dx:ASPxScheduler ID="ASPxScheduler1" ... >
    ...
    <CustomShortcuts>
        <dxwschs:SchedulerShortcut CommandName="ToggleSelection" Shortcut="enter" />
    </CustomShortcuts>
</dx:ASPxScheduler>

In the code behind, you can achieve this using the SchedulerCustomShortcutCollection.Add method.

protected void Page_Load(object sender, EventArgs e) {
    ASPxScheduler1.CustomShortcuts.Add(SchedulerShortcutCommands.ToggleSelection, "enter");
}

To remove an existing shortcut, override it with a custom shortcut whose SchedulerShortcut.CommandName property is set to an empty string.

<dx:ASPxScheduler ID="ASPxScheduler1" ... >
    ...
    <CustomShortcuts>
        <dxwschs:SchedulerShortcut CommandName="" Shortcut="delete" />
    </CustomShortcuts>
</dx:ASPxScheduler>
See Also