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?
I'm also interested in this. In my case I have a date field i would like grouped and sorted descending instead of ascending.
@rp8049: I am sorry, I did not quite understood what you are trying to achieve. Can you please provide more information (screenshot,sample,steps to reproduce) about this problem.
@JoeGershgorin:
Have you tried the direction property of the SortDescription.
If the user is grouping, you can use the Grouping event:
void xamDataGrid1_Grouping(object sender, Infragistics.Windows.DataPresenter.Events.GroupingEventArgs e)
{
e.Groups[0].Direction = System.ComponentModel.ListSortDirection.Descending;
}
If the XamDataGrid is loaded as grouped, you should set this in the FieldLayout sorted fields collection.
Regards,
Alex.
Hi,
I have groupings with the totals displaying in the group headers for all the numeric columns(ex col2, col3, col4) and group by is applied on col1 and colm5. If I sort by col2, I need the group by header to sort based on the totals for col2 on the group header. If i use custom GroupByComparer, it gives me GroupByRecord object for comparision, GroupByRecord object has just the description and not the cells by summary values(totals on the header) which I can use for sort comparision. How can I get the Totals on each of the group header from GroupByRecord.
Hello Jaffar,
You can use the following code, where “gbr” is the GroupByRecord:
int result; var summary = gbr.DescriptionWithSummaries.TrimStart(gbr.Description.ToCharArray()).Split(new char[]{' ',','}); for (int i = 0; i < summary.Length; i++) { if (summary[i] == "Count") { result = Int32.Parse(summary[i + 2]); } }
Hope this helps you.
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
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.