How to implement a custom Sort By Summary feature

The PivotGridFieldBase.SortBySummaryInfo property allows sorting data by displayed cell values and by using a custom summary algorithm. In the first case, it is necessary to specify the PivotGridFieldSortBySummaryInfo.Field property to sort data by fields summary values. In the second case, it is necessary to use the PivotGridFieldSortBySummaryInfo.FieldName property to select a data source field that should be used to calculate summaries. In the latter case, you can select a summary type via the PivotGridFieldSortBySummaryInfo.SummaryType property.
Built-in popup menu allow applying the Sort By Summary feature by using the PivotGridFieldSortBySummaryInfo.Field property. This example demonstrates how to customize such a menu to provide the Sort By Summary feature using the PivotGridFieldSortBySummaryInfo.FieldName property.