VGridControlBase.CustomRecordCellEdit Event
Allows you to associate an editor with an individual cell. To avoid performance issues and increased memory consumption, assign repository items that already exist in the VGridControl.RepositoryItems collection. Do not create new repository items in this handler.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
#Declaration
public event GetCustomRowCellEditEventHandler CustomRecordCellEdit
#Event Data
The CustomRecordCellEdit event's data class is GetCustomRowCellEditEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cell |
Gets the processed cell’s index.
Inherited from Row |
Record |
Gets the index of the record containing the processed cell.
Inherited from Row |
Repository |
Gets or sets the editor assigned to the processed cell. |
Row |
Gets the processed row.
Inherited from Row |
#Remarks
Use the RecordIndex and CellIndex event arguments to identify the processed cell. To assign an editor to the cell, use the RepositoryItem event argument. Note that the editor’s repository item should be added to the vertical grid’s RepositoryItems collection.
Important
The Repository
The RowEdit property and the CustomRecordCellEdit event allow you to specify the editor used to display and edit cell values. You can also handle the CustomRecordCellEditForEditing event to specify the editor used to edit cell values only.
See the following help topics for more information: Assign Editors to Editor Rows and Assigning Editors to Multi-Editor Rows.
#Example
The code below assigns editors to cells in the Quantity row.
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
this.Load += Form1_Load;
}
RepositoryItemSpinEdit riSpinEdit = new RepositoryItemSpinEdit();
RepositoryItemTextEdit riTextEdit = new RepositoryItemTextEdit();
RepositoryItemCalcEdit riCalcEdit = new RepositoryItemCalcEdit();
RepositoryItem[] inplaceEditors;
private void Form1_Load(object sender, EventArgs e) {
inplaceEditors = new RepositoryItem[] { riSpinEdit, riTextEdit, riCalcEdit };
vGridControl1.RepositoryItems.Add(riSpinEdit);
vGridControl1.RepositoryItems.Add(riTextEdit);
vGridControl1.RepositoryItems.Add(riCalcEdit);
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];
}
}