An interesting question from one of the MVVM Light users today:
Is there an MVVM-friendly way to get a DataGrid’s SelectedItems into the ViewModel?
The issue there is as old as the DataGrid (that’s not very old but still): SelectedItem (singular) is a DependencyProperty and can be databound to a property in the ViewModel. SelectedItems (plural) is not a DependencyProperty.
Thankfully the answer is very simple: Use EventToCommand to call a Command in the ViewModel, and pass the SelectedItems collection as parameter. For example, if the command in the ViewModel is declared as follows:
Read the rest of this entry »