The control comes with Excel-like key and mouse behaviour out of the box. There is no wiring to write.
Keyboard
Moving and selecting
| Key | What it does |
|---|---|
| ← ↑ → ↓ | Moves the active cell by one |
| Shift + arrow | Extends the selection |
| Tab / Shift+Tab | Right / left |
| Enter / Shift+Enter | Down / up |
| Home | To the start of the row (column A) |
| Ctrl + Home | To A1 |
| PageDown / PageUp | One screen down / up |
| Shift + PageDown / PageUp | Extends the selection by one screen |
Editing
| Key | What it does |
|---|---|
| F2 | Starts editing the cell |
| Any character | Replaces the content with it and starts editing |
| Delete / Backspace | Clears the active cell |
| Esc | Cancels the edit |
| Enter | Commits and moves down |
Formatting, history and clipboard
| Key | What it does |
|---|---|
| Ctrl + B / I / U | Bold / italic / underline (the selected characters while editing, the selected cells otherwise) |
| Ctrl + C / X / V | Copy / cut / paste |
| Ctrl + Z | Undo |
| Ctrl + Shift + Z / Ctrl + Y | Redo |
Ctrl+B and friends change target depending on whether you are editing: while editing a cell they apply to the selected characters, otherwise to the whole selection (Rich Text).
Mouse
| Action | What it does |
|---|---|
| Click | Selects a cell |
| Drag | Selects a range |
| Double-click | Starts editing the cell |
| Click a row or column header | Selects the whole row or column |
| Click the top-left corner | Selects the whole sheet |
| Drag a header boundary | Changes a row height or column width |
| Double-click a header boundary | Auto-fits it to the content |
| Drag the handle at the selection’s bottom-right | Auto-fill |
| Wheel | Scrolls vertically |
| Ctrl + wheel | Changes the zoom in 10% steps |
| Right-click | Raises ContextMenuRequested |
Click the ▽ on a header | Opens the auto-filter panel |
+ / − in the outline panel | Expands or collapses a group |
With several rows (or columns) selected, dragging a boundary inside the selection resizes all of them at once.
Resizing and auto-fill are recorded in the history, so Ctrl+Z reverses them (Undo and Redo).
Japanese input
Starting Japanese input on a cell that is not being edited opens the editor in place and continues the composition there. The candidate window appears at the active cell.
This is the same on all three of WinForms, WPF and Avalonia. The Avalonia build works the same way on Linux and macOS through each OS’s own input method.
Intercepting on the host side
There is no API for remapping keys. To change them, derive from the control and handle the key event first.
WinForms:
public class MyGrid : ReoGridControl
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.S) { Save(); e.Handled = true; return; }
base.OnKeyDown(e); // fall through to the defaults
}
}
WPF and Avalonia use the same shape (overriding OnKeyDown).
Setting e.Handled = true and not calling base prevents the default behaviour. To add
something after the default, call base first.
Application-wide shortcuts (Ctrl+S and the like) sit more naturally on the window than on the grid. The grid does not swallow keys it has no use for, so window menu accelerators keep working.
Preventing editing
For a read-only view, close the three doors that start an edit: F2 and Delete, typing a character, and double-clicking a cell.
public class ReadOnlyGrid : ReoGridControl
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode is Keys.F2 or Keys.Delete or Keys.Back) { e.Handled = true; return; }
base.OnKeyDown(e); // movement and copying still work
}
// stop a character keystroke from starting an edit
protected override void OnKeyPress(KeyPressEventArgs e) { e.Handled = true; }
// stop a double-click from starting one (do not call base)
protected override void OnMouseDoubleClick(MouseEventArgs e) { }
}
To block pasting (Ctrl+V) as well, add Keys.V when e.Control to the condition above.
If the goal is simply to forbid input, sheet protection is more reliable than swallowing
keys. Call ws.Protect() to protect the sheet and
ws.SetRangeLock(range, LockState.Unlocked) to open just the ranges that stay editable;
refusals are reported through ws.EditRefused.