My WPF app using an XMLDataProvider for its data. The XML file has a
<RELEASEDATE>dd/mm/yyyy</RELEASEDATE>
for each of the listed items. I’m sorting the data in the app using a
Listbox1.Items.SortDescriptions.Add(new SortDescription("RELEASEDATE", ListSortDirection.Descending));
The results aren’t what expected as the date is treated as a string.
What is the most elegant way around this? Can I somehow convert to a date inline?
You have to implement own IComparer:
and now assign the IComparer implementation to the collection’s ListCollectionView.CustomSort:
See similar Question