CustomCellInplaceEditorCollection.Add(CellRange, CustomCellInplaceEditorType) Method
Creates a custom cell in-place editor of the specified type and assigns it to the specified cell range.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
range | CellRange | A CellRange object that specifies a cell or cell range to which the custom in-place editor should be assigned. |
editorType | CustomCellInplaceEditorType | A CustomCellInplaceEditorType enumeration member that specifies the type of the custom editor to be used for in-place editing. |
Returns
Type | Description |
---|---|
CustomCellInplaceEditor | A CustomCellInplaceEditor object that specifies the created custom cell in-place editor. |
Remarks
Use the Add method to assign an in-place editor of the predefined type to a specific cell range in a worksheet. If the predefined editors do not comply with your requirements, handle the SpreadsheetControl.CustomCellEdit event to assign your own custom editor to worksheet cells. For details, refer to the How to: Assign Custom In-place Editors to Worksheet Cells example.
Example
// Use a date editor as the in-place editor for cells located in the "Order Date" column of the worksheet table.
CellRange dateEditRange = worksheet["Table[Order Date]"];
worksheet.CustomCellInplaceEditors.Add(dateEditRange, CustomCellInplaceEditorType.DateEdit);
// Use a combo box editor as the in-place editor for cells located in the "Category" column of the worksheet table.
// 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 of the worksheet table.
CellRange checkBoxRange = worksheet["Table[Discount]"];
worksheet.CustomCellInplaceEditors.Add(checkBoxRange, CustomCellInplaceEditorType.CheckBox);
// Use the custom control (SpinEdit) as the in-place editor for cells located in the "Quantity" column of the worksheet table.
// To provide the required editor, handle the CustomCellEdit event.
CellRange customRange = worksheet["Table[Qty]"];
worksheet.CustomCellInplaceEditors.Add(customRange, CustomCellInplaceEditorType.Custom, "MySpinEdit");
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(CellRange, CustomCellInplaceEditorType) method.
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.