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

[Solved] Background Colour Conditional Formatting for each row.

1 Answer 164 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon
Top achievements
Rank 1
Jon asked on 20 Jun 2013, 02:04 AM
I have the RadGrid bound to a List<Person>.

My Person object has a "Gender" property, returning either the string "F" or "M".

I have a convertor class that converts the string to a colour.

What markup should I use in the grid so that the background for each row reflects the correct colour for each person's gender?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivaylo Gergov
Telerik team
answered on 20 Jun 2013, 03:58 PM
Hi Jon,

Thank you for your question.

I have attached a sample project that demonstrates how to set different background colors of the grid rows depending on a property value.

As you can see, I have used the DataGridTextColumn.CellDecorationStyleSelector property which returns different styles according to the value of the Person.Gender property. The Style should target a Rectangle. 

I hope this was useful and feel free to contact us again if you need further assistance.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Grid for XAML
Asked by
Jon
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Share this question
or