I have a view with a dataGrid and the ViewModel. I want that when some condition occurs, deselect all the rows selected.
With Windows.Interactivity I can covert an event into a command, so with the event selectedChanged of the dataGrid. Then I check the conditions, and I can set the SelectedIndex to -1 if I want to deselect the items, nut this only works if I have only one item selected, if I have more than one, It does not work.
How can I deselect all the rows selected?
The
IsSelectedproperty of the rows should be bound to your VM anyway, so you should be able to iterate over the items and set it tofalse.