VGridControlBase.CustomRecordCellEdit Event

Enables editors to be assigned to individual cells.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v20.1.dll

Declaration

public event GetCustomRowCellEditEventHandler CustomRecordCellEdit
Public Event CustomRecordCellEdit As GetCustomRowCellEditEventHandler

Event Data

The CustomRecordCellEdit 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

The CustomRecordCellEdit event fires for each cell within the vertical grid. The event parameter's properties allow the row and record that contain the processed cell to be identified. A repository item that represents the desired editor can then be assigned to the GetCustomRowCellEditEventArgs.RepositoryItem property. Note that repository items must be added to the vertical grid's repository (EditorContainer.RepositoryItems).

By default, the editor assigned to a cell via the RowProperties.RowEdit property or the CustomRecordCellEdit event will be also used for editing the cell's contents. If you want to use a different editor for in-place editing, handle the VGridControlBase.CustomRecordCellEditForEditing event.

The following assigns different unique editors to the first three data cells of the "Quantity" row.

VGrid - Custom Cell Edit


public partial class Form1 : Form {
     public Form1() {
         InitializeComponent();
         this.Load += Form1_Load;
     }

     RepositoryItemSpinEdit riSpinEdit = new RepositoryItemSpinEdit();
     RepositoryItemCalcEdit riCalcEdit = new RepositoryItemCalcEdit();
     RepositoryItemTextEdit riTextEdit = new RepositoryItemTextEdit();
     RepositoryItem[] inplaceEditors;

     private void Form1_Load(object sender, EventArgs e) {
         inplaceEditors = new RepositoryItem[] { riSpinEdit, riTextEdit, riCalcEdit };
         vGridControl1.RepositoryItems.Add(riSpinEdit);
         vGridControl1.RepositoryItems.Add(riCalcEdit);
         vGridControl1.RepositoryItems.Add(riTextEdit);
         vGridControl1.CustomRecordCellEdit += VGridControl1_CustomRecordCellEdit;
         riTextEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
         riTextEdit.DisplayFormat.FormatString = "c2";

     }

     private void VGridControl1_CustomRecordCellEdit(object sender, DevExpress.XtraVerticalGrid.Events.GetCustomRowCellEditEventArgs e) {
         if (e.RecordIndex < 3 && e.Row.Properties.FieldName == "Quantity") e.RepositoryItem = inplaceEditors[e.RecordIndex];
     }
 }

For more information on assigning editors to individual cells, see Assigning Editors to Editor Rows and Assigning Editors to Multi-Editor Rows.

See Also