[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]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
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Printing
    Events
    Protection
    Operation Restrictions
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[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.

Note

A complete sample project is available in the DevExpress-Examples/how-to-assign-custom-in-place-editors-to-worksheet-cells-wpf-spreadsheet-t385458 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 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.

Expanded See Also

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