Skip to main content

Assigning Editors for In-place Editing

  • 4 minutes to read

This topic explains how to assign an editor to cells used only for in-place editing. For general information on in-place editors, see Cell Editors Overview.

Since all of our editor containers (Data Grid, Tree List, Pivot Grid, etc.) use similar approaches and APIs that allow you to replace default editors, you can also refer to the Data Grid documentation, the Cell Values, Editors, and Validation article.

Assigning Editors for In-place Editing

In-place editors can be assigned to all cells that correspond to a specific data field or to individual cells. By default, these editors will be used to represent cell values in display mode, and when an end-user starts editing, the same editor will be activated.

For those times when you may need to use a specific editor to represent data in display mode, but a different editor for in-place editing, do the following:

  1. Supply an editor that will be used in display mode (to a specific data field or to individual cells).
  2. After that, specify the editor that will be invoked solely for in-place editing using the PivotGridControl.CustomCellEditForEditing event.

    The PivotGridControl.CustomCellEditForEditing event fires when an end-user is about to start editing. Its parameters allow you to identify the currently processed cell. To provide an editor for editing, assign the corresponding RepositoryItem descendant to the event’s RepositoryItem parameter. Note that the repository item used should belong to the control’s DevExpress.XtraPivotGrid.PivotGridControl.RepositoryItems collection.


This example shows how to change the editor type when the editor is in “edit” mode.

The RepositoryItemProgressBar in-place editor (repository item) displays values of the “Quantity %” field as progress bars. In “edit” mode, the PivotGridControl.CustomCellEditForEditing event is raised to change this repository item to RepositoryItemTextEdit.


View Example

using System;
using System.Windows.Forms;
using DevExpress.Data.PivotGrid;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraPivotGrid;

namespace PivotGridControl_CustomCellEdit {
    public partial class Form1 : Form {
        public Form1() {
        // Creates new repository items.
        RepositoryItemTextEdit riTextEdit = new RepositoryItemTextEdit();
        RepositoryItemProgressBar riProgressBar = new RepositoryItemProgressBar();
        private void Form1_Load(object sender, EventArgs e) {
            // Initializes cell editors for this Pivot Grid control.
            pivotGridControl1.RepositoryItems.AddRange(new RepositoryItem[] { riTextEdit, riProgressBar });
        void pivotGridControl1_CustomCellEdit(object sender, PivotCustomCellEditEventArgs e) {
            // Specifies a cell editor which is used in both display and edit modes.
            if (e.DataField == fieldQuantityPercent & e.RowValueType == PivotGridValueType.Value)
                    e.RepositoryItem = riProgressBar;            
        void pivotGridControl1_CustomCellEditForEditing(object sender, PivotCustomCellEditEventArgs e) {
            // Overrides the cell editor for the edit mode.
            if (e.DataField == fieldQuantityPercent & e.RowValueType == PivotGridValueType.Value) 
                    e.RepositoryItem = riTextEdit;            
        private void pivotGridControl1_CustomCellValue(object sender, PivotCellValueEventArgs e) {
            if (e.DataField == fieldQuantityPercent)
                e.Value = Math.Round(Convert.ToDecimal(e.Value) * 100, 2);
See Also