Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RowCellStyleEventArgs Class

Provides data for the GridView.RowCellStyle event.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

public class RowCellStyleEventArgs :
    CustomRowCellEventArgs

#Remarks

The GridView.RowCellStyle event enables you to customize appearance settings of individual cells. The Grid control fires this event for each data cell, identifying the cell’s position using the RowCellStyleEventArgs object’s CustomRowCellEventArgs.RowHandle and CustomRowCellEventArgs.Column properties.

To customize appearance settings settings, use the RowCellStyleEventArgs.Appearance property.

Run Demo

#Example

The following code demonstrates how to customize the appearance of individual grid cells using the GridView.RowCellStyle event handler. The grid cells in this example are colored in a staggered manner. The following image demonstrates the result:

Examples.RowCellStyle

using DevExpress.XtraGrid.Views.Grid;

private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e) {
   GridView view = sender as GridView;
   if(view == null) return;
   if(e.RowHandle != view.FocusedRowHandle && 
      ((e.RowHandle % 2 == 0 && e.Column.VisibleIndex % 2 == 1) || 
      (e.Column.VisibleIndex % 2 == 0 && e.RowHandle % 2 == 1)))    
      e.Appearance.BackColor = Color.NavajoWhite;
}

#Inheritance

See Also