Hi,
i am currently facing issue to set the backgroud color to yellow when alternate row is true
i have grid in which few columns background is set to different colour. i have set highlightlight alterate row is to true. i have also set the yellow background when record is selected.
i have attached the sample project
here is style
Thanks Rob.
Its working fine
Hi ripalsoni,
The idea was that you would set the BackgroundAlternate property from your DataRecordCellArea style that you already have. I just noticed that you had a CellValuePresenter style though so actually whatever background you set there will override the BackgroundAlternate of the DataRecordCellArea.
The main reason why your cell is keeping the alternate row color when the row is selected is because of the order of DataTriggers in the CellValuePresenter style. You have a DataTrigger already that sets the Background to transparent when the record is selected but then after that you have another trigger that checks for IsAlternate and then sets the cell background. That IsAlternate check is going to force a background color no matter what since it was near the bottom.
To fix this just move the IsSelected DataTrigger after the IsAlternate trigger. I updated your sample to show this.
Hi Rob,
i don't understand clearly. can't we achieved this by style or data triggers?
You'll have to set the BackgroundAlternate property on the DataRecordCellArea if you have alternate rows enabled. There is a separate border element in the cell for the alternate background so if you don't set it, it will use it's default color on top of your desired background color.