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

How to get caption section of each group level

Thread ID:

Created:

Updated:

Platform:

Replies:

55389 Jan 29,2007 06:59 PM UTC Jan 30,2007 10:24 AM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 29, 2007 06:59 PM UTC

Hi,

I need to apply different color to the different group levels. How to get the caption section of each lower group level.

How to apply different colour to different lower group section in grid grouping control.

Please help

Administrator [Syncfusion]
Replied On January 29, 2007 07:28 PM UTC

Hi Harshad,

How to apply different colour to different lower group section in grid grouping control?

>>>>>
If you want to set the back color of the group based on column name than you can use the GridColumnDescriptorr.GroupByAppearance property. Here is a code snippet to show this.

this.gridGroupingControl1.TableDescriptor.Columns[0].GroupByAppearance.AnyCell.BackColor = Color.Pink;

If you want to set the back color of the group based on group level then you can handle the TableControlPrepareViewStyleInfo event and set the e.Inner.Style.BackColor property to new color to want to display.

//C# code.
private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
Element el = style.TableCellIdentity.DisplayElement as Element;

if( el.ParentGroup != null )
{
switch( el.ParentGroup.GroupLevel )
{
case 0:
e.Inner.Style.BackColor = Color.Red;
break;
case 1:
e.Inner.Style.BackColor = Color.Green;
break;
case 2:
e.Inner.Style.BackColor = Color.Blue;
break;
case 3:
e.Inner.Style.BackColor = Color.Yellow;
break;
default :
e.Inner.Style.BackColor = Color.WhiteSmoke;
break;
}
}
}

How to get the caption section of each lower group level?

>>>
Try this code in

GridCaptionSection caption = el.ParentGroup.Groups[0].Caption as GridCaptionSection;

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 30, 2007 10:24 AM UTC

Thanks a lot...

Its working fine

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.

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

;