Skip to main content
A newer version of this page is available. .

GroupSummarySortInfoCollection Class

Represents a collection which contains the information required to sort the group rows by summary values.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v18.2.dll

Declaration

[ListBindable(false)]
public class GroupSummarySortInfoCollection :
    CollectionBase,
    IEnumerable<GroupSummarySortInfo>,
    IEnumerable

The following members return GroupSummarySortInfoCollection objects:

Remarks

The GroupSummarySortInfoCollection class represents a collection which contains the information required to sort the group rows by the summary values. This collection can be accessed via the View’s GridView.GroupSummarySortInfo property. Each element in the collection is represented by a GroupSummarySortInfo object. Its properties specify the nesting level of the group rows that are to be sorted by the summary values and the sort order and summary item which is used to calculate summary values for groups of rows.

To add elements to the collection, use the GroupSummarySortInfoCollection.Add or GroupSummarySortInfoCollection.AddRange method. To cancel any sorting of the group rows by summary values, remove the corresponding GroupSummarySortInfo object from the collection. Note that the elements are automatically removed from the collection after the sort order of the group columns which they correspond to has been changed.

For more information on sorting group rows by summary values, see the Summaries document.

Example

The following example shows how to sort the group rows that reside at the first grouping level by summary values. The group summaries are calculated by the Freight column’s values.

The image below shows the result.

SummarySortInfo

using DevExpress.Data;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;

GridSummaryItem summaryItemMaxFreight;
private void Form1_Load(object sender, System.EventArgs e) {
   // ...
   //  Creating a new summary item and adding it the view's summary item collection.
   summaryItemMaxFreight = gridView1.GroupSummary.Add(SummaryItemType.Max, 
     "Freight", null, String.Empty);
}

private void button1_Click(object sender, System.EventArgs e) {
   GridColumn summaryColumn = gridView1.Columns["Freight"];
   if(summaryColumn.GroupIndex < 0 && gridView1.GroupCount > 0) {
      GridColumn firstGroupingColumn = gridView1.SortInfo[0].Column;
      gridView1.GroupSummarySortInfo.Add(summaryItemMaxFreight, 
        ColumnSortOrder.Ascending, firstGroupingColumn);
   }
}

Inheritance

Object
CollectionBase
GroupSummarySortInfoCollection
See Also