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.

GridGroupingControl - Customize look of grouping information

Thread ID:

Created:

Updated:

Platform:

Replies:

37367 Nov 21,2005 06:19 AM Nov 23,2005 11:34 AM Windows Forms 13
loading
Tags: GridControl
Badri Rajani Kanth
Asked On November 21, 2005 06:19 AM

Hi, in GGC, when I group by a column, I could see spme thing like columnname:xx - 10 items. I want to format this text and back color of the row. So that entire row in white background and font in bold etc....But where can I set this properties? can any body plz give me. Rgds Rajani Kanth

Administrator [Syncfusion]
Replied On November 21, 2005 06:51 AM

Try setting these properties: this.gridGroupingControl1.Appearance.GroupCaptionCell.BackColor = Color.Red; this.gridGroupingControl1.Appearance.GroupCaptionCell.Themed = false; //so back color will ''take'' this.gridGroupingControl1.Appearance.GroupCaptionCell.Font.Bold = true; this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{CategoryCaption}={Category}"; See the class reference help on CaptionText to see the tokens you can used with this property.

Badri Rajani Kanth
Replied On November 21, 2005 07:37 AM

Thank you. But when user clicks on one group caption row, I want to change backgroud color to say blue. where can I handle this? Rgds Rajani Kanth >Try setting these properties: > >this.gridGroupingControl1.Appearance.GroupCaptionCell.BackColor = Color.Red; >this.gridGroupingControl1.Appearance.GroupCaptionCell.Themed = false; //so back color will ''take'' >this.gridGroupingControl1.Appearance.GroupCaptionCell.Font.Bold = true; >this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{CategoryCaption}={Category}"; > > >See the class reference help on CaptionText to see the tokens you can used with this property. >

Administrator [Syncfusion]
Replied On November 21, 2005 07:49 AM

Try handling the QueryCellStyleInfo event. There if the item being drawn is a group caption and the item is th ecurrent item, then set it blue.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
		&& e.TableCellIdentity.Table.CurrentElement == e.TableCellIdentity.DisplayElement)
	{
		e.Style.BackColor = Color.Blue;
		e.Style.Themed = false;
	}
}

Badri Rajani Kanth
Replied On November 21, 2005 08:04 AM

Hi, Handling that event as well as the previous settings both does not reflect. Do you think I need to check with versions/any other settings? Rgds Rajani Kanth >Try handling the QueryCellStyleInfo event. There if the item being drawn is a group caption and the item is th ecurrent item, then set it blue. >
>private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
>{
>	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
>		&& e.TableCellIdentity.Table.CurrentElement == e.TableCellIdentity.DisplayElement)
>	{
>		e.Style.BackColor = Color.Blue;
>		e.Style.Themed = false;
>	}
>}
>

Administrator [Syncfusion]
Replied On November 21, 2005 08:38 AM

I don''t know. Those setting seem to affect things in this sample using version 3.3. http://www.syncfusion.com/Support/user/uploads/GGC_DateGrouping_f4dc9b55.zip Does this sample not work for you? What are you doing differently?

Badri Rajani Kanth
Replied On November 22, 2005 01:25 PM

Hi Clay, Sorry for late reply. The sample you sent is working fine. But my grid doesn''t show the changes. I have set so many properties and handled many events. I am not sure which property/event is stopping this new things. but I have never worked with gridGroupingControl1.Appearence object of GroupCaptionCell. So trying to figure out whatz going on..can you plz help me out? Rgds Rajani Kanth >I don''t know. Those setting seem to affect things in this sample using version 3.3. >http://www.syncfusion.com/Support/user/uploads/GGC_DateGrouping_f4dc9b55.zip > >Does this sample not work for you? What are you doing differently?

Administrator [Syncfusion]
Replied On November 22, 2005 01:28 PM

I do not understand. How would you like me to help you? Can you upload a sample project whose behavior you want modifed in some way and explain what you want done to it?

Badri Rajani Kanth
Replied On November 22, 2005 01:38 PM

I mean, I just want to know if any other properties/events can have effect on Appearance object of GroupCaptionCell. Rgds Rajani Kanth >I do not understand. How would you like me to help you? > >Can you upload a sample project whose behavior you want modifed in some way and explain what you want done to it?

Administrator [Syncfusion]
Replied On November 22, 2005 01:53 PM

There are many events that might prevent appearance properties from being seen. Events like TableControlPrepareViewStyleInfo and QueryCellStyleInfo can affect the look of every cell in the grid. Other events like TableControlDrawCell or TableControlCellDrawn or any other events having to do with drawing the cell might affect this. After you set the property, if you check it immediately, is it set properly? If you later check it in your code, has it been reset somehow? If so, you can try steepingthroug the code trying to see what is resetting the properties.

Badri Rajani Kanth
Replied On November 23, 2005 10:28 AM

Hi Clay, Thank You! I could figure out the problem and fixed it. Now I am trying to change the current groupcaption display. When I click on any groupcaption cell, QueryCellStyleInfo is not being called. Other events like Click are not giving me the cell type(GroupCaptionCell) and style. Any idea? Rgds Rajani Kanth >There are many events that might prevent appearance properties from being seen. > >Events like TableControlPrepareViewStyleInfo and QueryCellStyleInfo can affect the look of every cell in the grid. Other events like TableControlDrawCell or TableControlCellDrawn or any other events having to do with drawing the cell might affect this. > >After you set the property, if you check it immediately, is it set properly? If you later check it in your code, has it been reset somehow? If so, you can try steepingthroug the code trying to see what is resetting the properties.

Administrator [Syncfusion]
Replied On November 23, 2005 10:42 AM

Put a Console.WriteLine(DateTime.Now); at the top of your QueryCellStyleInfo code. Then run your code in debug with the ooutput window visible. I think you should see QueryCellStyleInfo being hit when you click a caption. I think it does get hit in the sample posted above. In the other events, if you add a Console.WriteLine(e.TableControl.GetTableCellViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).TableCellIdentity.TableCellType), what do you see when you click a caption?

Badri Rajani Kanth
Replied On November 23, 2005 11:28 AM

Hi, I am using the below given code in _TableControlCellClick event. The code is exceuted, cell type identified correctly, but display format is not changed. I think these may not be the right one. Plz check once. if( e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell) { Debug.WriteLine("Group Caption Clicked start"); string str1 = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).TableCellIdentity.TableCellType.ToString(); Debug.WriteLine(str1); Debug.WriteLine("Group Caption Clicked end"); e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).BackColor = Color.Blue; e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).TextColor = Color.White; e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).Themed = false; //so back color will ''''take'''' e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).Font.Bold = true; e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex).Borders.Bottom = new Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid, System.Drawing.SystemColors.Highlight, Syncfusion.Windows.Forms.Grid.GridBorderWeight.Thick); } Is "e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex)" giving me a read-only cell? Rgds Rajani Kanth

Badri Rajani Kanth
Replied On November 23, 2005 11:34 AM

Hey Clay, Itz working fine..Thanks a lot. I should appreciate your patience! Tanks again. Rgds Rajani Kanth

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.

;