Skip to main content

Events

  • 4 minutes to read

This topic contains a list of the WPF Spreadsheet events. These events allow you to:

Track User Activity

The table below lists events the Spreadsheet control raises in response to user actions.

User Action

Events

Create a blank workbook.

SpreadsheetControl.DocumentClosing

SpreadsheetControl.InitializeDocument

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.EmptyDocumentCreated

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Load a workbook.

SpreadsheetControl.DocumentClosing

SpreadsheetControl.BeforeImport

SpreadsheetControl.InitializeDocument

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.DocumentLoaded

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Save a workbook.

SpreadsheetControl.BeforeExport

SpreadsheetControl.ModifiedChanged

SpreadsheetControl.PropertyChanged

SpreadsheetControl.DocumentSaved

Print a workbook.

SpreadsheetControl.BeforePrintSheet

Insert a new worksheet.

SpreadsheetControl.SheetInserted

SpreadsheetControl.ActiveSheetChanging

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.UpdateUI

Click a worksheet’s tab on the Sheet Tab Selector.

SpreadsheetControl.ActiveSheetChanging

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.UpdateUI

Rename a worksheet.

SpreadsheetControl.SheetRenaming

SpreadsheetControl.SheetRenamed

SpreadsheetControl.UpdateUI

Delete a worksheet.

SpreadsheetControl.SheetRemoving

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.SheetRemoved

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.UpdateUI

Scroll a worksheet.

SpreadsheetControl.ScrollPositionChanged

SpreadsheetControl.VisibleRangeChanged

Insert columns in a worksheet.

SpreadsheetControl.ColumnsInserting

SpreadsheetControl.ColumnsInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Remove columns from a worksheet.

SpreadsheetControl.ColumnsRemoving

SpreadsheetControl.ColumnsRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Change the column width.

SpreadsheetControl.ColumnWidthChanged

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Insert rows in a worksheet.

SpreadsheetControl.RowsInserting

SpreadsheetControl.RowsInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Remove rows from a worksheet.

SpreadsheetControl.RowsRemoving

SpreadsheetControl.RowsRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Change the row height.

SpreadsheetControl.RowHeightChanged

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Freeze rows and columns.

SpreadsheetControl.PanesFrozen

SpreadsheetControl.ScrollPositionChanged

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.UpdateUI

Unfreeze rows and columns.

SpreadsheetControl.PanesUnfrozen

SpreadsheetControl.ScrollPositionChanged

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.UpdateUI

Expand or collapse row or column groups.

SpreadsheetControl.BeforeGroupProcessing

SpreadsheetControl.GroupStateChanging

SpreadsheetControl.GroupStateChanged

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.AfterGroupProcessing

SpreadsheetControl.UpdateUI

Click an outline button for row or column groups.

SpreadsheetControl.BeforeGroupProcessing

SpreadsheetControl.BeforeOutlineButtonClick

SpreadsheetControl.AfterOutlineButtonClick

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.AfterGroupProcessing

SpreadsheetControl.UpdateUI

Select cells, rows, columns, or drawing objects on a worksheet.

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Activate a cell’s in-place editor or formula bar, and begin to edit a cell value.

SpreadsheetControl.CellBeginEdit

SpreadsheetControl.CellEditorOpened

SpreadsheetControl.UpdateUI

Finish editing a cell and close the in-place editor.

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Press the ESC key to cancel the input.

SpreadsheetControl.CellCancelEdit

SpreadsheetControl.UpdateUI

Apply formatting to cells.

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Create a defined name.

SpreadsheetControl.DefinedNameValidating

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Edit a defined name.

SpreadsheetControl.DefinedNameEditing

SpreadsheetControl.DefinedNameValidating

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Remove a defined name.

SpreadsheetControl.DefinedNameDeleting

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Insert an image or chart.

SpreadsheetControl.ShapeInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Remove a drawing object.

SpreadsheetControl.ShapeRemoving

SpreadsheetControl.ShapeRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Copy the selected cell range.

SpreadsheetControl.RangeCopying

SpreadsheetControl.RangeCopied

Copy a drawing object.

SpreadsheetControl.ShapesCopying

Paste a cell range copied from the current workbook.

SpreadsheetControl.CopiedRangePasting

SpreadsheetControl.CellValueChanged

SpreadsheetControl.CopiedRangePasted

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Paste data from an external application or a cell’s in-place editor.

SpreadsheetControl.ClipboardDataPasting

SpreadsheetControl.ClipboardDataObtained

SpreadsheetControl.CellValueChanged

SpreadsheetControl.ClipboardDataPasted

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Paste a copied drawing object.

SpreadsheetControl.ShapeInserted

SpreadsheetControl.ClipboardDataPasted

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Drag and drop the selected cell range.

SpreadsheetControl.BeforeDragRange

SpreadsheetControl.BeforeDropRange

SpreadsheetControl.CellValueChanged

SpreadsheetControl.AfterDropRange

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Drag the fill handle to populate the adjacent cells with data.

SpreadsheetControl.BeforeDragRange

SpreadsheetControl.BeforeFillRange

SpreadsheetControl.CellValueChanged

SpreadsheetControl.AfterFillRange

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Insert a comment.

SpreadsheetControl.CommentInserting

SpreadsheetControl.CommentInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Remove a comment.

SpreadsheetControl.CommentRemoving

SpreadsheetControl.CommentRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Click a hyperlink.

SpreadsheetControl.HyperlinkClick

Change the zoom level.

SpreadsheetControl.VisibleRangeChanged

SpreadsheetControl.ZoomChanged

SpreadsheetControl.UpdateUI

Specify or edit document properties.

SpreadsheetControl.DocumentPropertiesChanged

Right-click the Spreadsheet control’s visual element.

SpreadsheetControl.PopupMenuShowing

Handle Exceptions

Handle the SpreadsheetControl.InvalidFormatException and SpreadsheetControl.UnhandledException events to catch exceptions that the Spreadsheet control does not process.

The SpreadsheetControl.InvalidFormatException event fires when a user attempts to load a document in an unsupported format.

The SpreadsheetControl.UnhandledException event allows you to catch exceptions that can occur when users execute commands via the Spreadsheet’s UI. For instance, when they attempt to save a document to a locked or read-only file.

Track Changes in a Document

The SpreadsheetControl.ContentChanged and SpreadsheetControl.ModifiedChanged events indicate that the current document was modified.

The SpreadsheetControl.ContentChanged event occurs each time the document’s content changes. When you use API methods to specify a cell’s value or format a cell, this leads to significant changes in the internal document model, and the ContentChanged event fires twice.

The SpreadsheetControl.ModifiedChanged event indicates that the current document was modified since it was loaded or last saved and the SpreadsheetControl.Modified property’s value changed. The SpreadsheetControl.ModifiedChanged event is also raised when you save the document because the SpreadsheetControl.Modified property’s value changes to false.

Track Modifications in Code

The Spreadsheet control raises events in response to changes in code. For instance, the SpreadsheetControl.PropertyChanged event fires each time a SpreadsheetControl‘s property changes. The SpreadsheetControl.UnitChanging and SpreadsheetControl.UnitChanged events fire when you use the SpreadsheetControl.Unit or ISpreadsheetComponent.Unit property to change the document’s measurement unit. If you set the SpreadsheetControl.ReadOnly property for the control, the SpreadsheetControl.ReadOnlyChanged event occurs.

There are events that usually fire only for changes performed via the Spreadsheet control’s UI: SpreadsheetControl.ActiveSheetChanged,SpreadsheetControl.SelectionChanged, SpreadsheetControl.CellValueChanged, and so on. Set the SpreadsheetControlOptions.RaiseEventsOnModificationsViaAPI property to true to raise these events when changes are made in code.