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

GridControl.GroupSummarySortInfo Property

Enables sorting group rows by their summary values.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v18.2.dll

Declaration

[Browsable(false)]
public GridGroupSummarySortInfoCollection GroupSummarySortInfo { get; }

Property Value

Type Description
GridGroupSummarySortInfoCollection

A GridGroupSummarySortInfoCollection object that contains the information required to sort group rows by summary values.

Remarks

Group rows displayed within the grid can be sorted by their summary values (if any). Group rows are sorted by summary values based upon the information provided by GridGroupSummarySortInfo objects. The properties introduced by these objects specify the sort order, summary item used to calculate summary values for groups of rows, etc.

To sort group rows by summary values, you should create a new GridGroupSummarySortInfo object with the specified settings (group summary item, grouping column and sort order) and add it to the GroupSummarySortInfo collection. To cancel sorting the group rows by summary values, remove the corresponding GridGroupSummarySortInfo object from the collection.

End-users can sort group rows by summary values via a context menu:

SortGroupRowsBySummary

Note

After group rows have been sorted by summary values, the sort order of a grouping column cannot be changed until the GridGroupSummarySortInfo object is removed from the GroupSummarySortInfo collection. End-users can do this by selecting ‘Clear Summary Sorting’ in a context menu invoked for the grouping column’s header.

To learn more, see Sorting Group Rows by Summary Values and Sorting Group Rows by Summary.

Example

This example shows how to sort group row by summary values.

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using DevExpress.Xpf.Grid;

namespace DXSample_SortGroupsBySummary {
    public partial class Window1 : Window {
        public Window1() {
            InitializeComponent();
            grid.ItemsSource = new AccountList().GetData();
            SortGroupsBySummary(view.GroupedColumns[0]);
        }
        private void SortGroupsBySummary(GridColumn column) {
            GridGroupSummarySortInfo sortInfo = new GridGroupSummarySortInfo(grid.GroupSummary[0],
                column.FieldName, System.ComponentModel.ListSortDirection.Ascending);
            grid.GroupSummarySortInfo.Add(sortInfo);
        }
    }
    public class AccountList {
        public List<Account> GetData() {
            return CreateAccounts();
        }
        private List<Account> CreateAccounts() {
            List<Account> list = new List<Account>();
            list.Add(new Account() { UserName = "Nick White", 
                RegistrationDate = DateTime.Today, Age = 57 });
            list.Add(new Account() { UserName = "Jack Rodman",
                RegistrationDate = new DateTime(2009, 5, 10), Age = 24 });
            list.Add(new Account() { UserName = "Sandra Sherry",
                RegistrationDate = new DateTime(2009, 5, 10), Age = 35 });
            list.Add(new Account() { UserName = "Sabrina Vilk",
                RegistrationDate = DateTime.Today, Age = 19 });
            list.Add(new Account() { UserName = "Mike Pearson",
                RegistrationDate = new DateTime(2008, 10, 18), Age = 42 });
            return list;
        }
    }
    public class Account {
        public string UserName { get; set; }
        public DateTime RegistrationDate { get; set; }
        public int Age { get; set; }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GroupSummarySortInfo property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also