This code will help you.
private void GetCell(DataGridRow row, DataGridColumn column)
{
DependencyObject parent = row;
Lable1:
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var item = VisualTreeHelper.GetChild(parent, i);
if (item is DataGridCellsPresenter)
{
DataGridCellsPresenter presenter = item as DataGridCellsPresenter;
DataGridCell cell = presenter.ItemContainerGenerator.ContainerFromIndex(1) as DataGridCell;
cell.Background = Brushes.Red;
break;
}
else
{
parent = item;
goto Lable1;
}
}
}