I want to know who are the selected items in the DataGrid (insert them to the collection in the ViewModel).
When I bind to the selected item is changed only when I click on the row (1 row), but when I press ctrl + clicking it remains the first item, why is this happening and is it possible to link all selected items?
Here my DataGrid:
<DataGrid SelectedIndex="{Binding SelectedXIndex}" DataContext="{Binding XViewModel}" SelectedItem="{Binding CurrentX}" ItemsSource="{Binding ListX, Mode=TwoWay}" AutoGenerateColumns="False" >
<DataGrid.Columns>
...
</DataGrid.Columns>
</DataGrid>
In the XViewModel I have:
SelectedXIndex
(int) for the selected index
CurrentX
(object of class x) for the current selection
ListX
- list of class x