windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-9ec876d7.md
Provides data for the GridView.RowCellStyle event.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public class RowCellStyleEventArgs :
CustomRowCellEventArgs
Public Class RowCellStyleEventArgs
Inherits CustomRowCellEventArgs
RowCellStyleEventArgs is the data class for the following events:
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](dxdemo://Win/XtraGrid/MainDemo/CodeExamples/Appearance_customization.Appearance_of_column_cells_(dynamically)
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:
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;
}
Imports DevExpress.XtraGrid.Views.Grid
Private Sub gridView1_RowCellStyle(ByVal sender As Object, _
ByVal e As RowCellStyleEventArgs) Handles gridView1.RowCellStyle
Dim view As GridView = sender
If view Is Nothing Then
Return
End If
If e.RowHandle <> view.FocusedRowHandle And _
((e.RowHandle Mod 2 = 0 And e.Column.VisibleIndex Mod 2 = 1) Or _
(e.Column.VisibleIndex Mod 2 = 0 And e.RowHandle Mod 2 = 1)) Then _
e.Appearance.BackColor = Color.NavajoWhite
End Sub
Object EventArgs CustomRowCellEventArgs RowCellStyleEventArgs
See Also