private void SortGroupsBySummary(GridColumn column) { GridGroupSummarySortInfo sortInfo = new GridGroupSummarySortInfo(grid.GroupSummary[0], column.FieldName, System.ComponentModel.ListSortDirection.Ascending); grid.GroupSummarySortInfo.Add(sortInfo); }
static void OnGridControlStartSorting(object sender, RoutedEventArgs e) { GridControl Grid = (GridControl)sender; if (!GetSortGroupSummaryWithColumn(Grid) || GetAlreadyHandled(Grid)) { return; } SetAlreadyHandled(Grid, true); foreach (GridSortInfo sortInfo in Grid.SortInfo) { GridSummaryItem summaryItem = FindGridSummaryItem(Grid, sortInfo.FieldName); if (summaryItem != null) { ArrayList groupedColumns = GetGroupedColumns(Grid); ArrayList newSortInfoList = new ArrayList(); foreach (GridColumn col in groupedColumns) { GridGroupSummarySortInfo groupSummaryInfo = FindGridGroupSummarySortInfo(Grid, summaryItem.FieldName); if (groupSummaryInfo != null && groupSummaryInfo.SortOrder == sortInfo.SortOrder) { continue; } GridGroupSummarySortInfo newSortInfo = new GridGroupSummarySortInfo(summaryItem, col.FieldName, sortInfo.SortOrder); newSortInfoList.Add(newSortInfo); e.Handled = true; } Grid.GroupSummarySortInfo.AddRange((GridGroupSummarySortInfo[])newSortInfoList.ToArray(typeof(GridGroupSummarySortInfo))); continue; } } SetAlreadyHandled(Grid, false); }