Alternate colors in GridListControl

Is it possible to alternate row colors of a GLC contained in a GridDataBoundGrid cell. Currently, all of the GLC rows inherit whatever the background color is of the cell contained in the GridDataBoundGrid. Thanks.

2 Replies

AD Administrator Syncfusion Team June 28, 2005 05:32 PM UTC

In Form.Load, you can subscribe to the embedded grid''s PrepareViewStyleInfo and use that event to alternate colors. GridDropDownGridListControlCellRenderer cr = this.gridDataBoundGrid1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.RowIndex % 2 == 1 && e.ColIndex > 0)
	{
		e.Style.BackColor = Color.Red;
	}
}


TP Tom Petrelli June 28, 2005 05:57 PM UTC

Thanks..., works perfect. >In Form.Load, you can subscribe to the embedded grid''s PrepareViewStyleInfo and use that event to alternate colors. > >GridDropDownGridListControlCellRenderer cr = this.gridDataBoundGrid1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; >cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); > > >
>private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
>{
>	if(e.RowIndex % 2 == 1 && e.ColIndex > 0)
>	{
>		e.Style.BackColor = Color.Red;
>	}
>}
>
> > >

Loader.
Up arrow icon