I'd like to sort it from the View instead of in the ViewModel.
Every example I've seen uses a SortDescription, but it's not customizable.
I'd like to sort it from the View instead of in the ViewModel.
Every example I've seen uses a SortDescription, but it's not customizable.
The ViewModel can also be responsible for data consumed by the View and its presentation, it is the model which should not be concerned about the display of the data.
You could bind your view to an ObservableCollection on the ViewModel, which your probably already have. You are not saying how you allow the user to sort, so for arguments sake I assuming a series of buttons, each button would be bound to an ICommand on the ViewModel, which would modify the ObservableCollection to change its order.
This would refresh the view with the new order in the ObservableCollection.
You are still maintaining your layers, and avoiding code behind and allowing your sorting logic to be tested.