Back to Devexpress

GridControl.GroupSummarySortInfo Property

wpf-devexpress-dot-xpf-dot-grid-dot-gridcontrol-3dbb6b2f.md

latest4.8 KB
Original Source

GridControl.GroupSummarySortInfo Property

Gets the information required to sort group rows by summary values.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
[Browsable(false)]
public GridGroupSummarySortInfoCollection GroupSummarySortInfo { get; }
vb
<Browsable(False)>
Public ReadOnly Property GroupSummarySortInfo As GridGroupSummarySortInfoCollection

Property Value

TypeDescription
GridGroupSummarySortInfoCollection

The information required to sort group rows by summary values.

|

Remarks

Sort Group Rows by Summary In Code

To sort group rows by summary values:

  1. Create a GridGroupSummarySortInfo object.
  2. Specify its settings (group summary item, grouping column’s field name and sort order).
  3. Add this object to the GroupSummarySortInfo collection.

This example demonstrates how to sort group rows by summary values in code:

View Example: Sort Group Rows by Summary Values

cs
public partial class Window1 : Window {
    public Window1() {
        InitializeComponent();
        grid.ItemsSource = AccountList.GetData();
        SortGroupsBySummary(view.GroupedColumns[0]);
    }
    void SortGroupsBySummary(GridColumn column) {
        GridGroupSummarySortInfo sortInfo = new GridGroupSummarySortInfo(grid.GroupSummary[0],
            column.FieldName, System.ComponentModel.ListSortDirection.Ascending);
        grid.GroupSummarySortInfo.Add(sortInfo);
    }
}
vb
Public Partial Class Window1
    Inherits Window

    Public Sub New()
        Me.InitializeComponent()
        Me.grid.ItemsSource = AccountList.GetData()
        Me.SortGroupsBySummary(Me.view.GroupedColumns(0))
    End Sub

    Private Sub SortGroupsBySummary(ByVal column As GridColumn)
        Dim sortInfo As GridGroupSummarySortInfo = New GridGroupSummarySortInfo(Me.grid.GroupSummary(0), column.FieldName, System.ComponentModel.ListSortDirection.Ascending)
        Me.grid.GroupSummarySortInfo.Add(sortInfo)
    End Sub
End Class
xaml
<dxg:GridControl x:Name="grid">
    <dxg:GridColumn FieldName="UserName"/>
    <dxg:GridColumn FieldName="RegistrationDate" GroupIndex="0"/>
    <dxg:GridColumn FieldName="Age"/>
    <dxg:GridControl.View>
        <dxg:TableView x:Name="view" AutoWidth="True"/>
    </dxg:GridControl.View>
    <dxg:GridControl.GroupSummary>
        <dxg:GridSummaryItem FieldName="Age" SummaryType="Max"/>
    </dxg:GridControl.GroupSummary>
</dxg:GridControl>

Remove the GridGroupSummarySortInfo object from the GroupSummarySortInfo collection to clear the summary sorting.

Sort Group Rows by Summary In UI

End users can press the Sort By Summary context menu’s button to sort group rows by summary values:

To clear sorting, end users should select the Clear Summary Sorting item from the grouping column’s header context menu.

Refer to the Sorting Group Rows by Summary Values and Sorting Group Rows by Summary topics for more information.

See Also

Sorting Group Rows by Summary Values

Sorting Group Rows by Summary

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace