Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1865
Resetting cell background color in code behind not working.
posted

In my xamDataGrid, I set the background color of some cells to gray based on user input - this is working fine. With a reset button above the grid, I want to reset cell backgrounds back to white - this is not working. Here is my code:

                    foreach (DataRecord dr in xgrdPositions.Records)
                    {
                        foreach (Cell cell in dr.Cells)
                        {
                            cell.DataPresenter.Background = Brushes.White;
                        }
                    }

The cells appear to randomly become gray/white when I click the reset button. Please help - what am I missing? I just need to set the background to white in code behind.

Thanks.