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

VGridControlBase.RecordCellStyle Event

Enables the appearance settings of individual cells to be changed.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v18.1.dll

Declaration

public event GetCustomRowCellStyleEventHandler RecordCellStyle

Event Data

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

Property Description
Appearance Gets the appearance settings used to paint the cell currently being processed.
CellIndex Gets the processed cell’s index. Inherited from RowCellEventArgs.
RecordIndex Gets the index of the record containing the processed cell. Inherited from RowCellEventArgs.
Row Gets the processed row. Inherited from RowEventArgs.

Remarks

The RecordCellStyle event is raised for individual cells before they need to be repainted. The referenced cell can be identified using the event parameter’s RowEventArgs.Row, RowCellEventArgs.RecordIndex and RowCellEventArgs.CellIndex properties. To customize the cell’s appearance settings use the GetCustomRowCellStyleEventArgs.Appearance property.

Individual cells can also be custom painted. Handle the VGridControlBase.CustomDrawRowValueCell event for this purpose.

Note

The control’s events designed to change the appearance or rendering of control elements must not be used to update cell values or to modify the control’s layout. Any inappropriate operation which causes a layout update, may break the normal control behavior.

Example

The following example handles the VGridControlBase.RecordCellStyle event to modify the appearance of the “Price” row’s cells whose values are greater than 30,000.

GetCustomRowCellStyle event

using DevExpress.XtraVerticalGrid.Events;

private void vGridControl1_RecordCellStyle(object sender, GetCustomRowCellStyleEventArgs e) {
   if(e.Row != rowPrice) return;
   if(Convert.ToInt32(vGridControl1.GetCellValue(e.Row, e.RecordIndex)) > 30000) {
      e.Appearance.BackColor = Color.Yellow;
      e.Appearance.ForeColor = Color.Black;
      e.Appearance.Font = new Font(e.Appearance.Font.Name, 
        e.Appearance.Font.Size, FontStyle.Bold);
   }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RecordCellStyle event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also