How can I get the list of rows in the DataGrid? Not the bound items, but the
DataGridRows
list.
I need to control the visibility of these rows and it's only possible to control it as a DataGridRow
and not as a data object.
Thanks!
You can get the row using ItemContainerGenerator. This should work -
for (int i = 0; i < dataGrid.Items.Count; i++)
{
DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator
.ContainerFromIndex(i);
}