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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternate the colour of the Group Headings

Thread ID:





72033 Feb 27,2008 11:32 AM UTC Mar 3,2008 09:00 AM UTC WinForms 2
Tags: GridControl
Asked On February 27, 2008 11:32 AM UTC

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?



Administrator [Syncfusion]
Replied On February 28, 2008 12:05 AM UTC

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;
e.Style.BackColor = Color.Blue;

Best regards,

Replied On March 3, 2008 09:00 AM UTC

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.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon