C#dataGrid背景色更改后会移动

做项目的时候使用dataGridRow.Background标红数据,打开软件后数据确实标红了,但是滚动数据,发现红色的背景居然会移动,从一条数据移动到另一条数据,有人知道为什么吗?

private void MarkExceptionRow(int rowIndex, bool marked)
{
this.Dispatcher.Invoke(new Action(() =>
{
this.resultDataGrid.UpdateLayout();
this.resultDataGrid.ScrollIntoView(this.resultDataGrid.Items[rowIndex]);
DataGridRow dataGridRow = (DataGridRow)this.resultDataGrid.ItemContainerGenerator.ContainerFromItem(this.resultDataGrid.Items[rowIndex]);
if (null == dataGridRow) { return; }
if (marked)
{
dataGridRow.Background = Brushes.Pink;
}
else
{
dataGridRow.Background = Brushes.White;
}
}));
}