Hi,
I am trying to make a custom sort comparer for a XamGrid TextColumn. My XamGrid is binded to an ICollectionView.
I have the following in the xaml:
<comparer:DateTimeStringComparer x:Key="MySortComparer"/>
<ig:TextColumn Key="LastPublished" SortComparer="{StaticResource MySortComparer}"> <ig:TextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="LAST PUBLISHED" /> </DataTemplate> </ig:TextColumn.HeaderTemplate> </ig:TextColumn>
Then my comparer:
public class DateTimeStringComparer : IComparer<string> { /// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public int Compare(string x, string y) {
var dateTimeX = Convert.ToDateTime(x); var dateTimeY = Convert.ToDateTime(y);
var dateTimeXStr = dateTimeX.ToString("s"); var dateTimeYStr = dateTimeY.ToString("s");
return StringComparer.OrdinalIgnoreCase.Compare(dateTimeXStr, dateTimeYStr); }
}
The SortComparer is not being invoke. I am not sure if it has something to do with what is binded (ICollectionView).
When debugging, I can see the TextColumn having the appropriate "SortComparer" but the "Compare" method does not get called ever when sorting.
Hello Erika,
I have investigated your issue, and I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have created a private case 'CAS-184153-B3C3R2' and logged this behavior in our internal tracking system with a Development ID of 237439. This will be assigned to a developer in a future sprint to review my investigation and confirm my findings or to offer a fix, or other resolution.
You can also continue to send updates to this case at any time.You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site. Please let me know if you need more information.
Thank you,Mihoko Kamiishi