Custom Cell In-place Editors

  • 4 minutes to read

This topic describes how to assign custom in-place editors to worksheet cells. An in-place editor in the Spreadsheet is activated when a user double-clicks a cell or presses F2 when a cell is selected. Custom cell editors can help you implement multiple usage scenarios such as the ability to create a data entry form within a workbook.

Select a Custom Editor from a Predefined Set

The SpreadsheetControl supports a predefined set of editors you can assign to cells without any configuration. This set includes:

Combo box


Date picker


Check box


To assign one of these editors to a cell or cell range, use the CustomCellInplaceEditorCollection.Add method of the worksheet’s Worksheet.CustomCellInplaceEditors collection. A CustomCellInplaceEditorType enumeration value specifies the created editor’s type.

If you use a combo box as a cell’s in-place editor (CustomCellInplaceEditorType.ComboBox), the value parameter of the CustomCellInplaceEditorCollection.Add method allows you to supply items for the editor’s drop-down list. You can use a string of comma-separated values or retrieve items from a cell range via the ValueObject.FromRange method. Value types other than a string or cell range are not permitted.

The example below demonstrates how to assign the above-mentioned editors to table cells.

View Example

// Use a date editor as the in-place editor for cells located in the "Order Date" column.
CellRange dateEditRange = worksheet["Table[Order Date]"];
worksheet.CustomCellInplaceEditors.Add(dateEditRange, CustomCellInplaceEditorType.DateEdit);

// Use a combo box as the in-place editor for cells located in the "Category" column.
// The editor's items are obtained from a cell range in the current worksheet.
CellRange comboBoxRange = worksheet["Table[Category]"];
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet["J3:J9"]));

// Use a check editor as the in-place editor for cells located in the "Discount" column.
CellRange checkBoxRange = worksheet["Table[Discount]"];
worksheet.CustomCellInplaceEditors.Add(checkBoxRange, CustomCellInplaceEditorType.CheckBox);

Use the CustomCellEdit event to Assign Your Own Editor to a Cell

If custom editors from the predefined set do not comply with your requirements, handle the SpreadsheetControl.CustomCellEdit event to assign your own editor to a cell. This 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, RowIndex and ColumnIndex parameters help you identify the currently edited cell. To supply a custom editor to the cell, create a BaseEditSettings descendant corresponding to the editor you want to use and assign it to the event’s SpreadsheetCustomCellEditEventArgs.EditSettings parameter. The In-Place Mode topic lists available in-place editors and their corresponding EditSettings classes.

The code snippet below shows how to assign a spin editor to the sixth column’s cells.


spreadsheetControl.CustomCellEdit += spreadsheetControl_CustomCellEdit;
// ...

private void spreadsheetControl_CustomCellEdit(object sender, DevExpress.Xpf.Spreadsheet.SpreadsheetCustomCellEditEventArgs e)
    if (e.SheetName == "Sales report" && e.ColumnIndex == 5 && e.RowIndex > 1)
        // Create a SpinEdit in-place editor and assign it to a cell.
        SpinEditSettings settings = new SpinEditSettings();
        settings.MinValue = 1;
        settings.MaxValue = 1000;
        settings.IsFloatValue = false;
        e.EditSettings = settings;
See Also