When I put data into any collection control in WPF (using MVVM), I always bind to the collection ItemsSource
property as well as the SelectedItem
or SelectedItems
properties, depending on the SelectionMode
of the control.
This enables me to find out which item(s) is/are selected and to choose whichever (data) item I want to be selected from the view model.
If the order that the user sets in the DataGrid
is important, then I would perform the sorting from the view model, but if it is only important to the user while they work, then you can simply ignore the order... remember, you can access the selected item through the bound SelectedItem
property in your view model.