Back to Devexpress

Keyboard Shortcuts

aspnet-117757-components-scheduler-concepts-keyboard-shortcuts.md

latest7.6 KB
Original Source

Keyboard Shortcuts

  • Dec 17, 2020
  • 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.

ShortcutCommandDescription
UpSchedulerShortcutCommands.NavigateUpMove selection up or select anappointment above depending on the selection mode.
DownSchedulerShortcutCommands.NavigateDownMove selection down or select an appointment below depending on the selection mode.
LeftSchedulerShortcutCommands.NavigateLeftMove selection left or select an appointment to the left depending on the selection mode.
RightSchedulerShortcutCommands.NavigateRightMove selection right or select an appointment to the right depending on the selection mode.
Shift + UpSchedulerShortcutCommands.ExpandSelectionUpExpand the current selection up.
Shift + DownSchedulerShortcutCommands.ExpandSelectionDownExpand the current selection down.
Shift + LeftSchedulerShortcutCommands.ExpandSelectionLeftExpand the current selection left.
Shift + RightSchedulerShortcutCommands.ExpandSelectionRightExpand the current selection right.
Ctrl + LeftSchedulerShortcutCommands.BackwardVisibleIntervalNavigate to the previous visible interval.
Ctrl + RightSchedulerShortcutCommands.ForwardVisibleIntervalNavigate to the next visible interval.
EnterSchedulerShortcutCommands.EditAppointmentStart editing the current appointment or create a new one.
TabSchedulerShortcutCommands.ToggleSelectionToggle between cell and appointment selection.
Shift+DSchedulerShortcutCommands.SwitchToDayViewSwitch to the Day View.
Shift+ESchedulerShortcutCommands.SwitchToWorkWeekViewSwitch to the Work Week View.
Shift+FSchedulerShortcutCommands.SwitchToFullWeekViewSwitch to the Full Week View.
Shift+WSchedulerShortcutCommands.SwitchToWeekViewSwitch to the Week View.
Shift+MSchedulerShortcutCommands.SwitchToMonthViewSwitch to the Month View.
Shift+TSchedulerShortcutCommands.SwitchToTimelineViewSwitch to the Timeline View.
Shift+ASchedulerShortcutCommands.SwitchToAgendaViewSwitch to the Agenda View.
Ctrl+CSchedulerShortcutCommands.CopyCopy the selected appointment.
Ctrl+VSchedulerShortcutCommands.PastePaste an appointment into the current cell.
Ctrl+XSchedulerShortcutCommands.CutCut the selected appointment.
DeleteSchedulerShortcutCommands.DeleteShortcutDelete 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.

  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.

  3. In the event handler, use the ShortcutEventArgs.commandName property to determine which shortcut has been pressed.

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.

aspx
<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.

csharp
protected void Page_Load(object sender, EventArgs e) {
    ASPxScheduler1.CustomShortcuts.Add(SchedulerShortcutCommands.ToggleSelection, "enter");
}
vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    ASPxScheduler1.CustomShortcuts.Add(SchedulerShortcutCommands.ToggleSelection, "enter")
End Sub

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

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

See Also

Online Demo: Keyboard Support