Changing a cell in a row of a DataGrid(WPF) is changing cells in rows below
background, c#, datagrid, wpf
Solution
Try using this:
<DataGrid Name="SimpleDataGrid" ScrollViewer.CanContentScroll="False" ... />
for scrolls in terms of physical units. It `DataGrid` `CanContentScroll` it is enabled by default.
For more information see MSDN.
Problem
I am trying to change the `Background` of some errorneous data containing cells in a WPF `DataGrid` by using this code: ``` DataGridRow gridRow = dgInventory.ItemContainerGenerator.ContainerFromIndex(0) as DataGridRow; DataGridCell cell = dgInventory.Columns[1].GetCellContent(gridRow).Parent as DataGridCell; cell.Background = Brushes.Gray; gridRow.IsSelected = true; gridRow.Focus(); ``` However, upon doing this, the above change of background-color change is occuring to cells in the same column, periodically after every 14 (aprox.) rows as I scroll down the `DataGrid`. It is only intended to modify the `Background` of a single row. Can someone please provide a fix to this problem? Thanks in advance.