How to bind SelectedItems property of multi-select enabled grid?

Dec 15, 2008 at 6:31 AM
I have a wpf datagrid where I have multi-select option for selecting rows.
Now i want to bind the SelectedItems property to a variable in my ViewModel to get the selections.
However there seems to be only a SelectedItem property on the grid which according to
gives only the first item in case of multiple selection.

How do I get the multiple selections via databinding?
Dec 15, 2008 at 8:41 AM

With multi-select DataGrids each DatGridRow has an IsSelected property which can be used to determine the current selection state. You can bind to this using a RelativeSource binding. See teh following example:

Colin E.