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 the colour of the Group Headings

Thread ID:

Created:

Updated:

Platform:

Replies:

72033 Feb 27,2008 06:32 AM Mar 3,2008 04:00 AM Windows Forms 2
loading
Tags: GridControl
Ken
Asked On February 27, 2008 06:32 AM

I'm using the Grid Grouping control on a flat table. Setting the grouping to be 3 columns within the table.

Is it possible to alternate the back colour of the group headings? Like the way you can with the rows?

Cheers

Ken


Administrator [Syncfusion]
Replied On February 27, 2008 07:05 PM

Hi Ken,

You can handle the QueryCellStyleInfo event and set the backcolor of the GroupCaptionCell. Below are the codes:

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption)
{
int i = el.GetRowIndex();
e.Style.Themed = false;
if( i %2 == 0)
e.Style.BackColor = Color.Red;
else
e.Style.BackColor = Color.Blue;
}
}

Best regards,
Haneef


Ken
Replied On March 3, 2008 04:00 AM

Thanks Haneef that worked. The only minor issue with it was that as I'm using the Office look & feel that is built in, the group header stays the same colour. However, the rows are now alternate colours and I can live with that.

Cheers
Ken


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.

;