VGridControlBase.CellValueChanged Event
Fires immediately after a cell’s value has been changed.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
#Declaration
public event CellValueChangedEventHandler CellValueChanged
#Event Data
The CellValueChanged event's data class is CellValueChangedEventArgs. 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 |
Row |
Gets the processed row.
Inherited from Row |
Value | Gets the current cell’s value. |
#Remarks
The CellValueChanged event fires in response to a cell’s value being changed. The list below points out the possible reasons for this event being raised:
- an end-user has closed an inplace editor after changing the edited cell’s value;
- a cell’s value has been changed using the methods provided by the grid control (for instance, the VGridControlBase.SetCellValue method);
The event doesn’t fire when a cell’s value is changed using the methods provided by the data source.
#Example
The following sample code handles the VGridControlBase.CellValueChanged
event to change the processed row’s style if its summary data cells value is greater than 100,000. To get a cell’s value, the code uses the VGridControlBase.GetCellValue method.
using DevExpress.Utils;
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.XtraVerticalGrid.Events;
private void vGridControl1_CellValueChanged(object sender, CellValueChangedEventArgs e) {
double sum = 0;
for (int i = 0; i < vGridControl1.RecordCount; i++)
sum += Convert.ToDouble(vGridControl1.GetCellValue(e.Row, i));
if (sum > 100000)
e.Row.Appearance.BackColor = Color.Red;
else
e.Row.Appearance.Options.UseBackColor = false;
}