[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Collapse]Cell Basics
     Cell Data Types
     Dates and Times in Cells
     Error Types
     Cell Referencing
     Formatting Cells
     Custom Cell In-place Editors
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Tables
   [Expand]Charts and Graphics
   [Expand]Mail Merge
    Operation Restrictions
    Find and Replace
   [Expand]Visual Elements
   [Expand]Keyboard Shortcuts
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Custom Cell In-place Editors

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.

Expanded 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.


A complete sample project is available in the DevExpress-Examples/how-to-assign-custom-in-place-editors-to-worksheet-cells-t385401 repository on GitHub.

Expanded 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 RepositoryItem descendant corresponding to the editor you want to use and assign it to the event's 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.

Expanded See Also

Is this topic helpful?​​​​​​​