Programmatically select multiple items in a DataGrid?

May 29, 2009 at 12:48 PM

I run unit tests on a datagrid, where I select rows by setting the DataGrid.SelectedIndex property.

This works ok.

But I would like to be able to select more  than one row in some tests.  Is that possible?  If so, how do I do it?



- Steinar

May 29, 2009 at 1:01 PM

Something like this might do the trick:


May 29, 2009 at 1:24 PM

Or add the underlying objects to the DataGrid.SelectedItems collection.