I have a Silverlight Toolkit datagrid where one column shows textual representation of a numeric value. I would like to sort on the column's underlying numeric value but present the text data to the user. Values in the grid column are in a format such as:
- A Category (200-300)
- Some Category (100-200)
- Yet Another Category (300-400)
As these values are textual the grid is correctly sorting on the text, however I have a custom Comparer which can already sort these by the numeric categories and would like to plug it into the grid.
The data-object that the grid cell is binding to only has the textual representation (and no way of easily adding the numeric value). Therefore, SortMemberPath= won't work in this case.
Is it possible to inject a custom comparer for a single grid column and sort on that? Or perhaps implement a CollectionViewSource with custom comparer? Remember this is Silverlight, not WPF so some fields/properties/classes are missing when compared to WPF.