Hello,
We are using a XamDataGrid with a number of columns, but no grouping. One of the columns must be sorted, not by the values in the column, but by another value from the same DataRecord.I've looked at the following posts:
https://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/75182/sort-groupby-coulmn-by-value-of-another-column-in-xamdatagridhttps://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/76675/icomparer---pass-datarecord-instead-of-cellvalue
The mentioned solution is interesting. However, these only seem to work when grouping.Is it possible do this without grouping, and to pass the DataRecord to the ICompare function instead of the cell values?
Thanks!
P.S. our current ICompare function is as follows. The objects are always strings, which means the cast never works.
// TODO: this only compares strings, not the totalStatusWeight public int Compare(object o1, object o2) { var item1 = o1 as ControlTowerOrderItem; var item2 = o2 as ControlTowerOrderItem; if (item1 == null || item2 == null) return 0;
return item1.TotalStatusWeight.CompareTo(item2.TotalStatusWeight); }
Thank you for contacting Infragistics!
We received your support request concerning sorting by another cell in the record instead of the passed in value of the sorted column, and this case has been assigned to me. I have done an initial review of your case and passing the record to the IComparer is not supported. Instead you will want to look into setting the sort evaluation mode to manual and manually sorting the column:
https://ko.infragistics.com/help/wpf/xamdatagrid-sorting-overview#_Ref340222695
Sincerely,Mike P.Software DeveloperInfragistics, Inc.www.infragistics.com
Thank you for the quick reply. We'll look into it.