I want to sort a WPF-Toolkit DataGrid on a column which is bound like this:
<toolkit:DataGrid.Columns>
<toolkit:DataGridTextColumn Header="MyColumn" Binding="{Binding AnObject.AProperty}" />
</toolkit:DataGrid.Columns>
Now when AnObject is null, an ArgumentException with the Message "At least one object must implement IComparable" will be thrown.
What's the best way to work around this limitation? I don't really want to change the domain model to return a NullObject-Pattern.
Using Convertors in combination with a binding directly to AnObject could turn out to be quite cumbersome, since I have many of those columns and more than one DataGrid.
Should I write a custom ViewModel foreach DataGrid and use a Converter on the ItemsSource Property?
I appreciate every suggestion!