Spread WPF 17
Spread WPF Documentation / Developer's Guide / Managing the User Interface / Using Keyboard Navigation
In This Topic
    Using Keyboard Navigation
    In This Topic

    You can change the active cell or select cells with the mouse or keyboard keys. You can also use keyboard keys to make changes to the cell data.

    The end user can use the following default, keyboard keys:

    Key Action Action Name
    Ctrl + Z Cancels the last user operation. Undo
    Ctrl + Y Repeats the last user operation. Redo
    Ctrl + Down Arrow Moves the active cell to the last row. NavigationBottom
    Down Arrow Moves the active cell down one cell. NavigationDown
    End Moves the active cell to the end of the row. NavigationEnd
    Ctrl + Right Arrow Moves the active cell to the end of the row. NavigationEnd
    Ctrl + Home Moves the active cell to the first cell in the control. NavigationFirst
    Home Moves the active cell to the first cell in the row. NavigationHome
    Ctrl + Left Arrow Moves the active cell to the first cell in the row. NavigationHome
    Ctrl + End Moves the active cell to the last cell in the control. NavigationLast
    Left Arrow Moves the active cell to the first cell in the row. NavigationLeft
    Tab Moves the active cell right to the next cell and down to the first cell in the next row when the active cell is at the end of a row. CommitInputNavigationTabNext
    Page Down Moves the active cell down to the next set of rows. NavigationPageDown
    Ctrl + PageUp Moves to the previous sheet. NavigationPreviousSheet
    PageUp Moves the active cell up to the next set of rows. NavigationPageUp
    Shift + Tab Moves the active cell left and wraps to the end of the previous row when the active cell is the first cell in the row. CommitInputNavigationTabPrevious
    Right Arrow Moves the active cell one cell to the right. NavigationRight
    Up Arrow Moves the active cell up a cell. NavigationUp
    Ctrl + Up Arrow Moves the active cell to the first cell in the column. NavigationTop
    Delete Clears the data in the cell if it is not in edit mode. Clear
    Backspace Clears the cell data if the cell is not in edit mode or moves a character to the left if the cell is in edit mode. ClearAndEditing
    Enter Moves the active cell down a cell and takes the cell out of edit mode. CommitInputNavigationDown
    Shift + Enter Moves the active cell up a cell and takes the cell out of edit mode. CommitInputNavigationUp
    Escape Removes the current typed characters if the cell is in edit mode. CancelInput
    Shift + Left Arrow Extends the selection one cell to the left of the active cell if the cell is not in edit mode (selects characters if the cell is in edit mode). SelectionLeft
    Shift + Right Arrow Extends the selection one cell to the right of the active cell if the cell is not in edit mode (selects characters if the cell is in edit mode). SelectionRight
    Shift + Up Arrow Extends the selection up one cell from the active cell if the cell is not in edit mode (selects cell characters if the cell is in edit mode). SelectionUp
    Shift + Down Arrow Extends the selection down one cell from the active cell if the cell is not in edit mode (selects cell characters if the cell is in edit mode).. SelectionDown
    Shift + Home Extends the selection from the active cell to the first cell in the row (selects cell characters if the cell is in edit mode). SelectionHome
    Shift + Ctrl + Left Arrow Extends the selection from the active cell to the first cell in the row. SelectionHome
    Shift + End Extends the selection from the active cell to the last cell in the row. SelectionEnd
    Shift + Ctrl + Right Arrow Extends the selection from the active cell to the last cell in the row. SelectionEnd
    Shift + Page Up Extends the selection one page up from the active cell. SelectionPageUp
    Shift + Page Down Extends the selection one page down from the active cell. SelectionPageDown
    Shift + Ctrl + Up Arrow Extends the selection from the active cell up to the first cell in the column. SelectionTop
    Shift + Ctrl + Down Arrow Extends the selection from the active cell down to the last cell in the column. SelectionBottom
    Shift + Ctrl + Home Extends the selection from the active cell to the first cell in the control. SelectionFirst
    Shift + Ctrl + End Extends the selection from the active cell to the last cell in the control. SelectionLast
    Ctrl + C Copies the selection to the Clipboard. Copy
    Ctrl + X Cuts the selection to the Clipboard. Cut
    Ctrl + V Pastes the data from the Clipboard. Paste
    Alt + Enter Creates and moves to a new line if the cell is in edit mode. InputNewLine

    Using Code

    The following example sets the active cell with the SetActiveCell method.

    CS
    Copy Code
    gcSpreadSheet1.Sheets[0].SetActiveCell(5, 5);
    gcSpreadSheet1.Invalidate();
    private void button1_Click(object sender, RoutedEventArgs e)
            {
            listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveCell().ToString());
            listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveColumn.ToString());
            listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveColumnIndex);
            listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveRow.ToString());
            listBox1.Items.Add(GcSpreadSheet1.Sheets[0].ActiveRowIndex);
            gcSpreadSheet1.Invalidate();
             }
    private void gcSpreadSheet1_EnterCell(object sender, GrapeCity.Windows.SpreadSheet.UI.EnterCellEventArgs e)
            {
            listBox1.Items.Add(e.Column.ToString());
            listBox1.Items.Add(e.Row.ToString());
            }
    private void gcSpreadSheet1_LeaveCell(object sender, GrapeCity.Windows.SpreadSheet.UI.LeaveCellEventArgs e)
        {
           listBox1.Items.Add(e.Column.ToString());
           listBox1.Items.Add(e.Row.ToString());
       }
    
    VB.NET
    Copy Code
    GcSpreadSheet1.Sheets(0).SetActiveCell(5, 5)
    GcSpreadSheet1.Invalidate()
    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
            ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveCell().ToString())
            ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveColumn.ToString())
            ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveColumnIndex)
            ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveRow.ToString())
            ListBox1.Items.Add(GcSpreadSheet1.Sheets(0).ActiveRowIndex)
            GcSpreadSheet1.Invalidate()
        End Sub
    Private Sub GcSpreadSheet1_EnterCell(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.EnterCellEventArgs) Handles GcSpreadSheet1.EnterCell
            ListBox1.Items.Add(e.Column.ToString())
            ListBox1.Items.Add(e.Row.ToString())
        End Sub
        Private Sub GcSpreadSheet1_LeaveCell(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.LeaveCellEventArgs) Handles GcSpreadSheet1.LeaveCell
            ListBox1.Items.Add(e.Column.ToString())
            ListBox1.Items.Add(e.Row.ToString())
        End Sub
    
    See Also