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. Image for the cookie policy date

How can I change the color of the Header of the GridGroupingControl after grouping when I click on it.

Hello,
How can I change the color of the Header of the GridGroupingControl after grouping by for example column "Suppliers" when I click on this header after grouping.

I have subscribed on such event:
private void clientGridControl_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
//....
//change the color of the header after grouping and when I clicked on this header
}

Best regards, Alexander Semichev.

2 Replies

AD Administrator Syncfusion Team November 2, 2006 04:13 AM UTC

Hi Alexander,

This can be acheived by handling the QueryCellStyleInfo event and set the backcolor of the column header cell if the column presents in the grouped column collection. Please try it and let us know if you need any further assistance

private void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell )
{
Syncfusion.Grouping.SortColumnDescriptorCollection columns = e.TableCellIdentity.Table.TableDescriptor.GroupedColumns;
if(columns != null && columns.Contains(e.Style.Text))
{
e.Style.Themed = false;
e.Style.BackColor = Color.Blue;
}
}
}

Here is a code snippet.
http://www.syncfusion.com/Support/user/uploads/GroupedColumns_7ee91fde.zip

Best Regards,
Haneef


AL Alexander November 2, 2006 10:54 AM UTC

Hi, thank for the help but it is not that I need... In the attachement there is a my sample where I try to change the color of the caption(Header of the Group) when I click on it after grouping!!!! Is this code is good and correct...

And one more question if we show the rows from the caption that was grouped by(we click on +(plus) of the caption) and when I clik on one of that rows - how I can to change the color of the caption row belongs to.

Send you my attachment with the sample!!!

>Hi Alexander,

This can be acheived by handling the QueryCellStyleInfo event and set the backcolor of the column header cell if the column presents in the grouped column collection. Please try it and let us know if you need any further assistance

private void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell )
{
Syncfusion.Grouping.SortColumnDescriptorCollection columns = e.TableCellIdentity.Table.TableDescriptor.GroupedColumns;
if(columns != null && columns.Contains(e.Style.Text))
{
e.Style.Themed = false;
e.Style.BackColor = Color.Blue;
}
}
}

Here is a code snippet.
http://www.syncfusion.com/Support/user/uploads/GroupedColumns_7ee91fde.zip

Best Regards,
Haneef


question_GroupedColumns.zip

Loader.
Live Chat Icon For mobile
Up arrow icon