I'm creating a xamDataGrid that groups by a name column. This works perfectly, but the sort order on the group headers seems to be alphabetical and applying a sort order by the date column only sorts the rows within the groups, it doesn't re-order the group headers themselves into date order.
Is there any way to do this or am I heading down a dead-end?
Hello Vamshi,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I used the “Bubble sort” in order to sort the Columns in the XamGrid’s Columns collection. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Hi Stefan,
i have a query in xamgrid.
How to i arrange the grid columns in alphabetical order. I mean i need to provide an option in xamgrid to allow the columns in alphabetical order
A workaround will be to use different sortComparer for different columns, but If I know the columns being sorted it will be more generic.
Thanks Stefan, this works fine if I have 1 column with total ... but if I have 2 columns with total in the summary, is there a way to know which column is being sorted in the sortcomparer... I can get the individual total value of these columns from SummaryDefinition in the SummaryResults but dont know which column value to use for comparision as I dont have the current column on which sort is being applied.
Thnx
Jaffar
Hello Jaffar,
If you set the GroupBySummaryDisplayMode to SummaryCellsAlwaysBelowDescription yo ucan use the following code:
Dispatcher.BeginInvoke(new Action(() => { GroupByRecordPresenter gbrp = GroupByRecordPresenter.FromRecord(gbr) as GroupByRecordPresenter; GroupBySummariesPresenter gbsp = Utilities.GetDescendantFromType(gbrp, typeof(GroupBySummariesPresenter), true) as GroupBySummariesPresenter; int result = Int32.Parse(gbsp.SummaryResults.Where(t => t.DisplayText.Contains("Count")).FirstOrDefault().Value.ToString()); }), DispatcherPriority.Background, null);
Hope this helps you.