Hi folks
I have a grid and I want to sort the grid by the number of items in groupby row (descending). Any idea how to do that? (I want the row with maximum number of items at top, ...)
UltraGridColumn exposes a SortComparer property, which is of type IComparer. This is a very simple interface with one method, Compare, which enables you to control the way the rows are sorted. I believe the BeforeSortChange event tells you whether the sort was triggered by a group-by column.
The way grouping works is that the grid first sorts the data in the column using the SortComparer (if there is one specified) and then it loop over the sorted rows and groups rows with similar values. So you cannot use the SortComparer property for this because the count will not exist yet when the SortComparer is called.
To sort the GroupByRows, you have to use the GroupByComparer property instead (which also takes an IComparer).