This page provides a comprehensive reference of all events available in ReoGrid, organized by category.

Workbook Events

Available on the ReoGrid control (workbook) instance:

EventEvent ArgsDescription
WorksheetCreatedWorksheetCreatedEventArgsA new worksheet was created
WorksheetInsertedWorksheetInsertedEventArgsA worksheet was inserted (provides Index)
WorksheetRemovedWorksheetRemovedEventArgsA worksheet was removed (provides Index)
BeforeWorksheetNameChangeWorksheetNameChangingEventArgsBefore a worksheet name changes (provides NewName, cancellable)
WorksheetNameChangedWorksheetNameChangingEventArgsAfter a worksheet name changed
WorksheetNameBackColorChangedWorksheetEventArgsTab background color changed
WorksheetNameTextColorChangedWorksheetEventArgsTab text color changed
SettingsChangedEventArgsAny workbook setting changed
ExceptionHappenedExceptionHappenEventArgsAn internal exception occurred (provides Exception, Worksheet, CellPosition)

Action Events

EventEvent ArgsDescription
BeforeActionPerformBeforeActionPerformEventArgsBefore any action is performed (cancellable via IsCancelled)
ActionPerformedWorkbookActionEventArgsAfter an action is performed (provides Action)
UndidWorkbookActionEventArgsAfter an undo operation
RedidWorkbookActionEventArgsAfter a redo operation

File I/O Events

EventEvent ArgsDescription
WorkbookLoadedEventArgsAfter a workbook file is loaded
WorkbookSavedEventArgsAfter a workbook file is saved

Worksheet Events

Available on individual worksheet instances. Access via grid.CurrentWorksheet or grid.Worksheets[index].

Cell Data Events

EventEvent ArgsDescription
CellDataChangedCellEventArgsA cellโ€™s data changed (provides Cell)
RangeDataChangedRangeEventArgsData in a range was updated (provides Range)

Cell Edit Events

EventEvent ArgsDescription
BeforeCellEditCellBeforeEditEventArgsBefore a cell enters edit mode (cancellable, provides EditText)
AfterCellEditCellAfterEditEventArgsAfter editing finishes (provides NewData, EndReason, DataFormat)
CellEditTextChangingCellEditTextChangingEventArgsText is changing during editing (provides Text)
CellEditCharInputedCellEditCharInputEventArgsA character was input (provides InputChar, CaretPositionInLine, LineIndex, InputText)
CellValidationCellValidationEventArgsAfter validation on editing text (provides Failures, IsValid)

Cell Mouse Events

EventEvent ArgsDescription
CellMouseEnterCellMouseEventArgsMouse entered a cell
CellMouseLeaveCellMouseEventArgsMouse left a cell
CellMouseMoveCellMouseEventArgsMouse moved within a cell
CellMouseDownCellMouseEventArgsMouse button pressed on a cell
CellMouseUpCellMouseEventArgsMouse button released on a cell

CellMouseEventArgs Properties:

PropertyTypeDescription
CellCellThe cell involved
CellPositionCellPositionCell position
IsCancelledboolSet to true to cancel
ButtonsMouseButtonsWhich mouse button
RelativePositionPointPosition relative to the cell
AbsolutePositionPointAbsolute position on the control
ClicksintNumber of clicks
DeltaintMouse wheel delta
CaptureboolWhether to capture the mouse
CursorStyleCursorStyleCursor style to display

Keyboard Events

EventEvent ArgsDescription
BeforeCellKeyDownBeforeCellKeyDownEventArgsKey pressed (before native behavior, cancellable)
AfterCellKeyDownAfterCellKeyDownEventArgsKey pressed (after native behavior)
CellKeyUpCellKeyDownEventArgsKey released

CellKeyDownEventArgs Properties:

PropertyTypeDescription
CellCellThe focused cell
CellPositionCellPositionCell position
KeyCodeKeyCodeThe key that was pressed

BeforeCellKeyDownEventArgs adds IsCancelled (bool).

Selection Events

EventEvent ArgsDescription
BeforeSelectionRangeChangeBeforeSelectionChangeEventArgsBefore selection changes (cancellable, modifiable)
SelectionRangeChangingRangeEventArgsDuring selection change (while dragging)
SelectionRangeChangedSelectionRangeChangedEventArgsAfter selection is finalized
SelectionModeChangedEventArgsSelection mode changed
SelectionStyleChangedEventArgsSelection style changed
SelectionForwardDirectionChangedEventArgsSelection forward direction changed
SelectionMovedForwardSelectionMovedForwardEventArgsSelection moved forward (cancellable)
SelectionMovedBackwardSelectionMovedBackwardEventArgsSelection moved backward (cancellable)
FocusPosChangedEventArgsFocus cell position changed
FocusPosStyleChangedEventArgsFocus position style changed
HoverPosChangedEventArgsMouse hover cell changed

See Selection for detailed usage.

Row and Column Events

EventEvent ArgsDescription
RowsInsertedRowsInsertedEventArgsRows were inserted (provides Row, Count)
RowsDeletedRowsDeletedEventArgsRows were deleted (provides Row, Count)
ColumnsInsertedColumnsInsertedEventArgsColumns were inserted (provides Index, Count)
ColumnsDeletedColumnsDeletedEventArgsColumns were deleted (provides Index, Count)
RowsHeightChangedRowsHeightChangedEventArgsRow height changed (provides Row, Count, Height)
ColumnsWidthChangedColumnsWidthChangedEventArgsColumn width changed (provides Index, Count, Width)
RowFilteredA filter was applied to rows
RowSortedRows were sorted

See Rows, Columns & Headers for details.

Range Events

EventEvent ArgsDescription
RangeMergedRangeEventArgsA range was merged
RangeUnmergedRangeEventArgsA range was unmerged
RangeStyleChangedRangeEventArgsStyles were set on a range

Range Move/Copy Events

EventEvent ArgsDescription
BeforeRangeCopyBefore the selected range is copied
AfterRangeCopyAfter a range copy operation
BeforeRangeMoveBefore the selected range is moved
AfterRangeMoveAfter a range move operation

Border Events

EventEvent ArgsDescription
BorderAddedBorderAddedEventArgsBorders were set (provides Pos, Style)
BorderRemovedBorderRemovedEventArgsBorders were removed (provides Pos)

Outline Events

EventEvent ArgsDescription
OutlineAddedOutlineAddedEventArgsAn outline was added
OutlineRemovedOutlineRemovedEventArgsAn outline was removed
BeforeOutlineCollapseBeforeOutlineCollapseEventArgsBefore collapse (cancellable)
AfterOutlineCollapseAfterOutlineCollapseEventArgsAfter collapse
BeforeOutlineExpandBeforeOutlineExpandingEventArgsBefore expand (cancellable)
AfterOutlineExpandAfterOutlineExpandingEventArgsAfter expand

See Group & Outline for detailed usage.

Freeze Events

EventTypeDescription
CellsFrozenEventHandlerWorksheet was frozen
CellsUnfrozenEventHandlerWorksheet was unfrozen

See Freeze Panes for details.

Clipboard Events

EventEvent ArgsDescription
BeforeCopyBefore a copy operation
AfterCopyAfter a range is copied to clipboard
BeforePasteBefore a paste operation
AfterPasteAfter a range is pasted from clipboard
BeforeCutBefore a cut operation
AfterCutAfter a range is cut
OnPasteErrorError occurred during paste

Conditional Style Events

EventTypeDescription
ConditionalStyleCellChangedEventHandlerConditional style cells were updated

See Conditional Styles for details.

Scale Event

EventEvent ArgsDescription
ScaledEventArgsZoom level changed

Other Events

EventEvent ArgsDescription
NameChangedEventArgsWorksheet name changed
ResettedEventArgsWorksheet was reset
SettingsChangedSettingsChangedEventArgsWorksheet settings changed

Common Event Patterns

Cancellable Events

Many โ€œBeforeโ€ events have an IsCancelled property. Set it to true to prevent the operation:

// Prevent cell editing
sheet.BeforeCellEdit += (s, e) => e.IsCancelled = true;

// Prevent outline collapse
sheet.BeforeOutlineCollapse += (s, e) => e.IsCancelled = true;

// Prevent selection change
sheet.BeforeSelectionRangeChange += (s, e) => e.IsCancelled = true;

Restrict Editing to a Range

var editableRange = new RangePosition(3, 1, 2, 3);

sheet.SetRangeBorders(editableRange, BorderPositions.Outside, RangeBorderStyle.BlackSolid);
sheet[2, 1] = "Edit only allowed in this range:";

sheet.BeforeCellEdit += (s, e) =>
    e.IsCancelled = !editableRange.Contains(e.Cell.Position);

41

Track Data Changes

sheet.CellDataChanged += (s, e) =>
{
    Console.WriteLine($"Cell {e.Cell.Address} changed to: {e.Cell.Data}");
};

sheet.RangeDataChanged += (s, e) =>
{
    Console.WriteLine($"Range {e.Range.ToAddress()} data changed");
};

Custom Key Handling

sheet.BeforeCellKeyDown += (s, e) =>
{
    if (e.KeyCode == KeyCode.Enter)
    {
        e.IsCancelled = true;
        // Custom navigation
        sheet.SelectRange(sheet.SelectionRange.Row + 1, 0, 1, 1);
    }
};
Was this article helpful?