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

GridGroupingControl - Customize look of grouping information

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

13 Replies

AD Administrator Syncfusion Team November 21, 2005 11:51 AM UTC

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.


BR Badri Rajani Kanth November 21, 2005 12:37 PM UTC

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. >


AD Administrator Syncfusion Team November 21, 2005 12:49 PM UTC

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;
	}
}


BR Badri Rajani Kanth November 21, 2005 01:04 PM UTC

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;
>	}
>}
>


AD Administrator Syncfusion Team November 21, 2005 01:38 PM UTC

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?


BR Badri Rajani Kanth November 22, 2005 06:25 PM UTC

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?


AD Administrator Syncfusion Team November 22, 2005 06:28 PM UTC

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?


BR Badri Rajani Kanth November 22, 2005 06:38 PM UTC

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?


AD Administrator Syncfusion Team November 22, 2005 06:53 PM UTC

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.


BR Badri Rajani Kanth November 23, 2005 03:28 PM UTC

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.


AD Administrator Syncfusion Team November 23, 2005 03:42 PM UTC

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?


BR Badri Rajani Kanth November 23, 2005 04:28 PM UTC

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


BR Badri Rajani Kanth November 23, 2005 04:34 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon