This is a migrated thread and some comments may be shown as answers.

How to reset cell backcolor?

1 Answer 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
MP
Top achievements
Rank 1
MP asked on 27 Oct 2009, 07:24 PM

I have a grid with cell backcolor customized in the CellFormatting event (selected cells are highlighted as blue). Once the cells are not selected, I need to return the cell backcolor to its original color. I first tried setting e.CellElement.BackColor = Color.Empty;

 

 

 & Color.Transparent but this makes the cell as White instead of following the AlternateRowColor. After going through the documentation, I found that I can use CellElement.ResetValue(VisualElement.BackColorProperty). This seems to work better since it respects the AlternateRowColor. However, when I am using some of the Themes, it doesn't respect the ThemeColors. Is there something I am missing?

Regards,
MP

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 28 Oct 2009, 10:37 AM
Hi MP,

Yes, in this case you have to reset the property value by using ResetValue method, and specify ValueResetFlags.Local. Here is a sample:

this.ResetValue(BackColorProperty, ValueResetFlags.Local);

Should you have any questions, don't hesitate to ask.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
MP
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or