//hook the event
GridControl grid = gridListControl1.Grid;
grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
//the event handler private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if( e.RowIndex > 0) { if(e.RowIndex % 2 == 1) { e.Style.BackColor = Color.Blue; } else { e.Style.BackColor = Color.AliceBlue; } } }
> //hook the event
> GridControl grid = gridListControl1.Grid;
> grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
>
>
>
> > //the event handler > private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) > { > if( e.RowIndex > 0) > { > if(e.RowIndex % 2 == 1) > { > e.Style.BackColor = Color.Blue; > } > else > { > e.Style.BackColor = Color.AliceBlue; > } > } > } >Clay do you have the code in VB.net? I am not familiar with C#. Thanks, Bill
' in form load
'hook the event
Dim grid As GridControl = gridListControl1.Grid
AddHandler grid.PrepareViewStyleInfo, AddressOf grid_PrepareViewStyleInfo
' the handler 'the event handler Private Sub grid_PrepareViewStyleInfo(sender As Object, e As GridPrepareViewStyleInfoEventArgs) If e.RowIndex > 0 Then If e.RowIndex Mod 2 = 1 Then e.Style.BackColor = Color.Blue Else e.Style.BackColor = Color.AliceBlue End If End If End Sub 'grid_PrepareViewStyleInfo
Imports Syncfusion.Windows.Forms.Grid
as the first line in your file (outside the class definition).