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.

colors in grouping grid

Thread ID:

Created:

Updated:

Platform:

Replies:

31325 Jul 5,2005 02:56 PM Jul 6,2005 04:01 PM Windows Forms 2
loading
Tags: Grouping
Faraz Haque
Asked On July 5, 2005 02:56 PM

Hi, Is it possible to use different color for different grouping levels in a grouping grid. I use a caption summary grid, and if i have 3 grouping (summary) levels, each level has the same color. The actual record cells have a different color though. For example if i have a grid with Country , State , city and city population, if i add country and state as grouped cols, and summarize city population, I will get country total and state totals in the same color. I need this to be a bit different. Any help would be great.

Administrator [Syncfusion]
Replied On July 5, 2005 07:34 PM

So you have summaries in the group caption row? If so, you can try using QueryCellStyleInfo to color the different levels. Here is code that colors level 1.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
	{
		GridCaptionRow caption = e.TableCellIdentity.DisplayElement as GridCaptionRow;
		if(caption.ParentGroup.GroupLevel == 1)
			e.Style.BackColor = Color.LightGoldenrodYellow;
	}
}

Administrator [Syncfusion]
Replied On July 6, 2005 04:01 PM

You can also modify the color for individual grouping levels if you change GridColumnDescriptor.GroupByAppearance. For example, if you grouped by "Country" and "Region", you can change the formatting with
grid.TableDescriptor.Columns["Country"].GroupByAppearance.GroupCaptionCell.BackColor = Color.Green;
grid.TableDescriptor.Columns["Region"].GroupByAppearance.GroupCaptionCell.BackColor = Color.Blue;
Stefan >So you have summaries in the group caption row? If so, you can try using QueryCellStyleInfo to color the different levels. Here is code that colors level 1. >
>private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
>{
>	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
>	{
>		GridCaptionRow caption = e.TableCellIdentity.DisplayElement as GridCaptionRow;
>		if(caption.ParentGroup.GroupLevel == 1)
>			e.Style.BackColor = Color.LightGoldenrodYellow;
>	}
>}
>
>

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.

;