/***********************************************************************
/* Description: Accessing the DataGridRow from WPF DataGrid by row index */
***********************************************************************/
DataGridRow dgr = (DataGridRow)dataGrid1.ItemContainerGenerator.ContainerFromIndex(nRowIndex);
if (dgr == null) // row might be invisible (top / bottom). So, scroll into the view and get it
{
dataGrid1.UpdateLayout();
dataGrid1.ScrollIntoView(dataGrid1.Items[nRowIndex]);
dgr = (DataGridRow)dataGrid1.ItemContainerGenerator.ContainerFromIndex(nRowIndex);
}