- 4 minutes to read
This topic provides a list of 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.
Create a blank workbook.
Load a workbook.
Save a workbook.
Print a workbook.
Insert a new worksheet.
Click a worksheet’s tab on the Sheet Tab Selector.
Rename a worksheet.
Delete a worksheet.
Scroll a worksheet.
Insert columns in a worksheet.
Remove columns from a worksheet.
Change the column width.
Insert rows in a worksheet.
Remove rows from a worksheet.
Change the row height.
Freeze rows and columns.
Unfreeze rows and columns.
Select cells, rows, columns, or drawing objects on a worksheet.
Activate a cell’s in-place editor or formula bar, and begin to edit the cell’s value.
Finish editing a cell and close the in-place editor.
Press the ESC key to cancel the input.
Apply formatting to cells.
Create a defined name.
Edit a defined name.
Remove a defined name.
Insert an image or chart.
Remove a drawing object.
Copy the selected cell range.
Copy a drawing object.
Paste a cell range copied from the current workbook.
Paste data from an external application or a cell’s in-place editor.
Paste a copied drawing object.
Drag and drop the selected cell range.
Drag the fill handle to populate the adjacent cells with data.
Insert a comment.
Remove a comment.
Click a hyperlink.
Change the zoom level.
Specify or edit document properties.
Right-click the Spreadsheet control’s visual element.
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 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.