WPF DataGrid programmatic multiple row selection
- by MicMit
Is there anything simpler than sample below ? I do have observable collection ( "list" in the code ) bound to DataGrid lstLinks
for (int i = 0; i < list.Count ; i++)
{
object rowItem = lstLinks.Items[i] ;
DataGridRow visualItem = (DataGridRow)lstLinks.ItemContainerGenerator.ContainerFromItem(rowItem);
if (list[i].Changed)
visualItem.IsSelected = false;
else
visualItem.IsSelected = false;
}