Back to Devexpress

SpreadsheetCellEventArgs.Action Property

officefileapi-devexpress-dot-xtraspreadsheet-dot-spreadsheetcelleventargs-de318eda.md

latest4.1 KB
Original Source

SpreadsheetCellEventArgs.Action Property

Identifies an action which caused a change of the cell value.

Namespace : DevExpress.XtraSpreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public CellValueChangedAction Action { get; }
vb
Public ReadOnly Property Action As CellValueChangedAction

Property Value

TypeDescription
CellValueChangedAction

A CellValueChangedAction enumeration value identifying an action.

|

Available values:

NameDescription
Edit

End-user has modified the cell value using worksheet editors.

| | UndoRedo |

Cell value has been changed by executing the undo or redo command.

| | Paste |

New value has been pasted into the cell.

| | API |

Cell value has been modified programmatically.

|

Remarks

Use the Action property to determine whether a change of the cell value is caused by end-user editing, an undo/redo operation or a programmatic cell value modification.

Tip

The WorkbookEventOptions.RaiseOnModificationsViaAPI option should be set to true to raise the SpreadsheetControl.CellValueChanged or SpreadsheetControl.CellValueChanged event when the cell value is modified programmatically.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Action property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L134

csharp
void spreadsheetControl1_CellValueChanged(object sender, SpreadsheetCellEventArgs e) {
    if (e.Action == CellValueChangedAction.UndoRedo || e.OldValue == e.Cell.Value ||
        e.Cell.GetReferenceA1(ReferenceElement.IncludeSheetName) != "Invoice!B10")

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L124

vb
Private Sub spreadsheetControl1_CellValueChanged(ByVal sender As Object, ByVal e As SpreadsheetCellEventArgs)
    If e.Action = CellValueChangedAction.UndoRedo OrElse e.OldValue Is e.Cell.Value OrElse Not Equals(e.Cell.GetReferenceA1(ReferenceElement.IncludeSheetName), "Invoice!B10") Then Return
    Dim invoice As Worksheet = e.Worksheet

See Also

SpreadsheetControl.CellValueChanged

SpreadsheetControl.CellValueChanged

SpreadsheetCellEventArgs Class

SpreadsheetCellEventArgs Members

DevExpress.XtraSpreadsheet Namespace