)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize group caption summary appearance in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 29, 2016 |
Last Revised Date: February 12, 2020

Customize the group caption summary

In order to show the total item and total count of the caption summary in the group caption row with appearance customization, it can be handled by the following codes.

C#

GridSummaryColumnDescriptor scd = new GridSummaryColumnDescriptor("Sum", SummaryType.DoubleAggregate, "Freight", "Total : {Sum:#}");
GridSummaryColumnDescriptor scd1 = new GridSummaryColumnDescriptor("Count", SummaryType.DoubleAggregate, "EmployeeID", "{Count:#} : items");
GridSummaryRowDescriptor srd = new GridSummaryRowDescriptor("Sum");
srd.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Left;
srd.SummaryColumns.AddRange(new GridSummaryColumnDescriptor[] { scd, scd1 });
this.gridGroupingControl1.GetTableDescriptor("Orders").SummaryRows.Add(srd);
this.gridGroupingControl1.ChildGroupOptions.ShowCaptionSummaryCells = true;
this.gridGroupingControl1.ChildGroupOptions.ShowSummaries = false;
this.gridGroupingControl1.ChildGroupOptions.CaptionSummaryRow = "Sum";
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("CustomerID");
this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{CategoryCaption}: {Category}";
this.gridGroupingControl1.TableDescriptor.Appearance.GroupCaptionSummaryCell.BackColor = Color.FromArgb(240, 241, 242);
this.gridGroupingControl1.Appearance.GroupCaptionCell.CellType = "Static";
this.gridGroupingControl1.Appearance.GroupCaptionCell.Borders.Top = new GridBorder(GridBorderStyle.None);

VB

Private scd As New GridSummaryColumnDescriptor("Sum", SummaryType.DoubleAggregate, "Freight", "Total : {Sum:#}")
Private scd1 As New GridSummaryColumnDescriptor("Count", SummaryType.DoubleAggregate, "EmployeeID", "{Count:#} : items")
Private srd As New GridSummaryRowDescriptor("Sum")
srd.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Left
srd.SummaryColumns.AddRange(New GridSummaryColumnDescriptor() { scd, scd1 })
Me.gridGroupingControl1.GetTableDescriptor("Orders").SummaryRows.Add(srd)
Me.gridGroupingControl1.ChildGroupOptions.ShowCaptionSummaryCells = True
Me.gridGroupingControl1.ChildGroupOptions.ShowSummaries = False
Me.gridGroupingControl1.ChildGroupOptions.CaptionSummaryRow = "Sum"
Me.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("CustomerID")
Me.gridGroupingControl1.ChildGroupOptions.CaptionText = "{CategoryCaption}: {Category}"
Me.gridGroupingControl1.TableDescriptor.Appearance.GroupCaptionSummaryCell.BackColor = Color.FromArgb(240, 241, 242)
Me.gridGroupingControl1.Appearance.GroupCaptionCell.CellType = "Static"
Me.gridGroupingControl1.Appearance.GroupCaptionCell.Borders.Top = New GridBorder(GridBorderStyle.None)

Show the caption summary

Samples:

C#: Caption Summary

VB: Caption Summary

Reference link: https://help.syncfusion.com/windowsforms/gridgrouping/summaries

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon