CustomCellInplaceEditorCollection.Add(Range, 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.v19.1.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
range | Range | A Range 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
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-assign-custom-in-place-editors-to-worksheet-cells-t385401
' Use a date editor as the in-place editor for cells located in the "Order Date" column of the worksheet table.
Dim dateEditRange As Range = 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.
Dim comboBoxRange As Range = 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.
Dim checkBoxRange As Range = 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.
Dim customRange As Range = 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(Range, 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.