Skip to main content
A newer version of this page is available. .

VGridControlBase.CustomRecordCellEditForEditing Event

Allows you to assign a custom editor to a cell for in-place editing, and so override the default row editor, which is by default, used both in display and edit modes.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v19.1.dll

Declaration

public event GetCustomRowCellEditEventHandler CustomRecordCellEditForEditing

Event Data

The CustomRecordCellEditForEditing event's data class is GetCustomRowCellEditEventArgs. The following properties provide information specific to this event:

Property Description
CellIndex Gets the processed cell’s index. Inherited from RowCellEventArgs.
RecordIndex Gets the index of the record containing the processed cell. Inherited from RowCellEventArgs.
RepositoryItem Gets or sets the editor assigned to the processed cell.
Row Gets the processed row. Inherited from RowEventArgs.

Remarks

You can assign an in-place editor to a row via the RowProperties.RowEdit property, or to an individual row cell via the VGridControlBase.CustomRecordCellEdit event. This editor will be used to represent a cell’s contents in display mode (when the cell isn’t currently edited), and by default in edit mode. If you need to provide different editors to represent a cell’s contents differently in display and edit modes, handle the CustomRecordCellEditForEditing event.

To assign an editor to a cell for in-place editing while handling the CustomRecordCellEditForEditing event, assign a corresponding repository item to the RepositoryItem parameter. Note that the repository item must belong to the grid control’s RepositoryItems collection (see the inherited EditorContainer.RepositoryItems property) or to an external repository (see the EditorContainer.ExternalRepository property).

The following example illustrates how to assign the ProgressBarControl for all “Quantity” cells, and replace this editor with a SpinEdit when a user starts modifying a cell value.

VGrid - Editor for editing


using DevExpress.XtraEditors.Repository;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace VGrid_Editors_Test {
    public partial class Form1 : Form {
        RepositoryItem editorForDisplay, editorForEditing;
        public Form1() {
            InitializeComponent();
            this.Load += Form1_Load;
            vGridControl1.CustomRecordCellEditForEditing += VGridControl1_CustomRecordCellEditForEditing;
        }

        private void Form1_Load(object sender, EventArgs e) {
            // Initialize the editors and assign the default editor to a column.
            editorForDisplay = new RepositoryItemProgressBar();
            editorForEditing = new RepositoryItemSpinEdit();
            vGridControl1.RepositoryItems.AddRange(
              new RepositoryItem[] { editorForDisplay, editorForEditing });
            vGridControl1.GetRowByFieldName("Quantity").Properties.RowEdit = editorForDisplay;
        }

        private void VGridControl1_CustomRecordCellEditForEditing(object sender, DevExpress.XtraVerticalGrid.Events.GetCustomRowCellEditEventArgs e) {
            if (e.Row.Properties.FieldName == "Quantity")
                e.RepositoryItem = editorForEditing;
        }
    }
}
See Also