SpreadsheetControl.CustomCellEdit Event
Allows you to assign a custom in-place editor to a cell.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v24.2.dll
NuGet Package: DevExpress.Win.Spreadsheet
#Declaration
public event SpreadsheetCustomCellEditEventHandler CustomCellEdit
#Event Data
The CustomCellEdit event's data class is SpreadsheetCustomCellEditEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cell |
Gets the cell for which the event is fired.
Inherited from Spreadsheet |
Column |
Gets the index of the column that contains the cell.
Inherited from Spreadsheet |
Formula |
Gets the formula that is currently contained in the cell.
Inherited from Spreadsheet |
Formula |
Gets the formula in the invariant culture that is currently contained in the cell.
Inherited from Spreadsheet |
Repository |
Gets or sets the in-place editor for the current cell. |
Row |
Gets the index of the row that contains the cell.
Inherited from Spreadsheet |
Sheet |
Gets the name of the worksheet that contains the cell.
Inherited from Spreadsheet |
Value |
Gets the value currently contained in the cell.
Inherited from Spreadsheet |
Value |
Gets a value associated with the Custom |
Worksheet |
Gets the worksheet that contains the cell.
Inherited from Spreadsheet |
#Remarks
The CustomCellEdit event fires each time an end user starts to edit a cell and allows you to replace the built-in cell editor with a custom one. The event’s Cell, ColumnIndex and RowIndex parameters help you identify the currently edited cell. To supply a custom editor to the cell, create a RepositoryItem descendant corresponding to the editor you want to use and assign it to the event’sDevExpress.XtraSpreadsheet.SpreadsheetCustomCellEditEventArgs.RepositoryItem parameter. Refer to the Editors and Simple Controls topic for additional information on this mechanism. The Included Controls and Components document lists available editors and their corresponding repository items.
The code snippet below shows how to assign a spin editor to the sixth column’s cells.
spreadsheetControl.CustomCellEdit += spreadsheetControl_CustomCellEdit;
// ...
//Create a repository item corresponding to a SpinEdit control
RepositoryItemSpinEdit repository = new RepositoryItemSpinEdit();
private void spreadsheetControl_CustomCellEdit(object sender, DevExpress.XtraSpreadsheet.SpreadsheetCustomCellEditEventArgs e)
{
if (e.SheetName == "Sales report" && e.ColumnIndex == 5 && e.RowIndex > 1)
{
//specify the repository item settings.
repository.AutoHeight = false;
repository.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
repository.MinValue = 1;
repository.MaxValue = 1000;
repository.IsFloatValue = false;
// Assign the spin editor to a cell.
e.RepositoryItem = repository;
}
}
#Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomCellEdit event.
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.