We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Alternate colors in GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30986 Jun 28,2005 01:07 PM Jun 28,2005 01:57 PM Windows Forms 2
loading
Tags: GridControl
Tom Petrelli
Asked On June 28, 2005 01:07 PM

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.

Administrator [Syncfusion]
Replied On June 28, 2005 01:32 PM

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;
	}
}

Tom Petrelli
Replied On June 28, 2005 01:57 PM

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;
>	}
>}
>
> > >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;