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
325
Change Record / Cells Background
posted

I i'm triyng to change the background of every cell on my xamdatagrid so it appears like a chess, but in this simplier example im only tryinh to reproduce stripes like one record is AliceBlue and the other green then alice blue then green etc.

But with this code the xamdatagrid ("dataGridCampaignPriority") is getting always green.

  int count = 0;
            foreach (Record rec in dataGridCampaignPriority.Records)
            {
                DataRecord dr = rec as DataRecord;
                foreach (Cell cell in dr.Cells)
                {
                        if(count%2==0)
                            cell.DataPresenter.Background = Brushes.AliceBlue;
                        else
                            cell.DataPresenter.Background = Brushes.Green;
                }
                count++;
            }