[]
Spread for WPF provides a wide range of keyboard navigation shortcuts that help you efficiently perform worksheet operations.
The following table lists all supported available keyboard shortcuts:
Key Combination | Action Description | Action Name |
|---|---|---|
Esc | If in edit mode, restores the cell value to its previous value before changes and exits edit mode. | CancelEditing |
Ctrl + B<br>Ctrl + 2 | Toggles bold formatting for the current selection. | Bold |
Ctrl + 0 | Hides the selected columns. | HideColumns |
Ctrl + 9 | Hides the selected rows. | HideRows |
Ctrl + Shift + 9 | Unhides the selected rows. | UnhideRows |
Ctrl + Shift + 0 | Unhides the selected columns. | UnhideColumns |
Shift + PgUp | Extends the selection up by one page. | ExtendOneScreenUpSelection |
Shift + PgDn | Extends the selection down by one page. | ExtendOneScreenDownSelection |
Alt + Shift + PgUp | Extends the selection left by one page. | ExtendOneScreenLeftSelection |
Alt + Shift + PgDn | Extends the selection right by one page. | ExtendOneScreenRightSelection |
Home | Moves the active cell to the first cell of the row. | MoveToFirstCellInRow |
Ctrl + Home | If freeze pane is enabled, this shortcut will go to the upper left cell in the current pane. If freeze pane is not enabled, this shortcut will go the cell upper left cell in the worksheet (A1). | MoveToFirstCell |
Alt + = | Calculates the sum of the selected cells. | AutoSumSelectedCells |
F2 | Puts the cell into edit mode and places the cursor at the end of the cell text. | EditActiveCell |
F9 | Calculate all worksheets in all open workbooks. | CalculateWorksheets |
Delete | Deletes the cell value. | Delete |
Backspace | Deletes the cell value and enters edit mode. | Backspace |
Ctrl + Shift + : | Enters the current time as a static value. | InsertCurrentTime |
Ctrl + ; | Enters the current date as a static value. | InsertCurrentDate |
Ctrl + Shift + " | Copies the value from the cell above to the selected cell(s) and stays in edit mode. If the above cell is a formula, only the value is copied. | CopyValueFromCellAbove |
Ctrl + ' | Copies the formula from the cell above to the active cell and stays in edit mode. | CopyFormulaFromCellAbove |
Ctrl + Enter | When multiple cells are selected, enters the same data into all selected cells at once. If a single cell is selected, enters the value and keeps it selected. | EnterSameDataInMultipleCells |
← | Moves the current selection one cell to the left. | MoveLeft |
→ | Moves the current selection one cell to the right. | MoveRight |
↓ | Moves the current selection one cell down. | MoveDown |
↑ | Moves the current selection one cell up. | MoveUp |
PgDn | Moves the current selection down by one page. | MoveDownByScreen |
PgUp | Moves the current selection up by one page. | MoveUpByScreen |
Shift + Tab | Move the active cell one cell to the left. If multiple cells are selected, the active cell moves within the selection. | MovePrevious |
Tab | Move the active cell one cell to the right. If multiple cells are selected, the active cell moves within the selection. | MoveNext |
End | Moves to the last cell of the row. | MoveToLastCellInRow |
Ctrl + End | The last cell is at the intersection of the last row that contains data and the last column that contains data. The last cell may or may not contain data. | MoveToLastCell |
Ctrl + → | If the active cell is empty, stops at the first non-empty cell to the right; if not empty, stops at the last non-empty cell to the right. | MoveRightDataEdge |
Ctrl + ← | If the active cell is empty, stops at the first non-empty cell to the left; if not empty, stops at the last non-empty cell to the left. | MoveLeftDataEdge |
Ctrl + ↓ | If the active cell is empty, stops at the first non-empty cell below; if not empty, stops at the last non-empty cell below. | MoveDownDataEdge |
Ctrl + ↑ | If the active cell is empty, stops at the first non-empty cell above; if not empty, stops at the last non-empty cell above. | MoveUpDataEdge |
Ctrl + Backspace | Scrolls the worksheet to display the active cell. | ShowActiveCell |
Shift + Backspace | When multiple cells are selected, selects only the active cell. | SelectActiveCell |
Enter | Loops through all cells in the selection from top-left to bottom-right. | MoveActiveCell |
Ctrl + . | Loops through all cells in the selection from top-left to bottom-right. | MoveActiveCell |
Shift + Enter | Loops through all cells in the selection from bottom-right to top-left. | MoveActiveCell |
Shift + → | Extends the selection to the right by one cell. | ExtendOneCellRightSelection |
Shift + ← | Extends the selection to the left by one cell. | ExtendOneCellLeftSelection |
Shift + ↑ | Extends the selection upward by one cell. | ExtendOneCellUpSelection |
Shift + ↓ | Extends the selection downward by one cell. | ExtendOneCellDownSelection |
Ctrl + Shift + → | Extends the current selection to the last cell on the right. | ExtendLastCellRightSelection |
Ctrl + Shift + ← | Extends the current selection to the first cell on the left. | ExtendLastCellLeftSelection |
Ctrl + Shift + ↑ | Extends the current selection to the first cell above. | ExtendLastCellUpSelection |
Ctrl + Shift + ↓ | Extends the current selection to the last cell below. | ExtendLastCellDownSelection |
Shift + Space | Selects the entire row(s). If the selection spans multiple rows, all intersecting rows are selected. | SelectEntireRow |
Ctrl + Space | Selects the entire column(s). If the selection spans multiple columns, all intersecting columns are selected. | SelectEntireColumn |
Ctrl + A | Selects the entire worksheet. | SelectEntireTableOrWorksheet |
Ctrl + Shift + ~ | Applies the standard number format. | GeneralFormat |
Ctrl + Shift + $ | Applies the currency format with two decimal places. | CurrencyFormat |
Ctrl + Shift + % | Applies the percentage format without decimal places. | PercentageFormat |
Ctrl + Shift + ^ | Applies the scientific format with two decimal places. | ScientificFormat |
Ctrl + Shift + # | Applies the date format with day, month, and year. | DateFormat |
Ctrl + Shift + @ | Applies the time format showing hours and minutes, including AM/PM. | TimeFormat |
Ctrl + Shift + ! | Applies the number format with two decimal places, thousand separators, and minus sign for negative values. | NumberFormat |
Ctrl + I<br>Ctrl + 3 | Toggles italic formatting for the current selection. | Italic |
Ctrl + 5 | Toggles strikethrough formatting for the current selection. | Strikethrough |
Ctrl + U<br>Ctrl + 4 | Toggles underline formatting for the current selection. | Underscoring |
Ctrl + Z | Undoes various actions. | - |
Ctrl + Y | Redoes various actions. | - |
In Spread for WPF, you can also customize the above shortcuts according to your actual needs. Here are some examples of custom shortcuts and their implementations:
Use the Enter key to move the active cell to the right
Use Ctrl + Shift + Enter to enter cell edit mode
Use Ctrl + V to disable the default paste operation
C#
public partial class CustomizingKeyboardShortcuts : Window
{
public CustomizingKeyboardShortcuts()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 1. Use Enter to move the active cell to the right.
spreadSheet1.InputBindings.Add(new KeyBinding(BuiltInCommands.MoveRight, new KeyGesture(Key.Enter)));
// 2. Use Ctrl + Shift + Enter to enter cell edit mode.
spreadSheet1.InputBindings.Add(new KeyBinding(BuiltInCommands.EditActiveCell, new KeyGesture(Key.Enter, ModifierKeys.Control | ModifierKeys.Shift)));
// 3. Use Ctrl + V to disable the default paste command.
// This will override the default paste command for Ctrl + V.
spreadSheet1.InputBindings.Add(new InputBinding(ApplicationCommands.NotACommand, new KeyGesture(Key.V, ModifierKeys.Control)));
}
}VB
Public Partial Class CustomizingKeyboardShortcuts
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
' 1. Use Enter to move the active cell to the right.
spreadSheet1.InputBindings.Add(New KeyBinding(BuiltInCommands.MoveRight, New KeyGesture(Key.Enter)))
' 2. Use Ctrl + Shift + Enter to enter cell edit mode.
spreadSheet1.InputBindings.Add(New KeyBinding(BuiltInCommands.EditActiveCell, New KeyGesture(Key.Enter, ModifierKeys.Control Or ModifierKeys.Shift)))
'3. Use Ctrl + V to disable the default paste command.
'This will override the default paste command for Ctrl + V.
spreadSheet1.InputBindings.Add(New InputBinding(ApplicationCommands.NotACommand, New KeyGesture(Key.V, ModifierKeys.Control)))
End Sub
End Class