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

Change Row Background color based on condition

3 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
farizvi
Top achievements
Rank 1
farizvi asked on 25 Feb 2016, 12:40 PM
I've been trying to change the row background color in radgridview based on a condition in RowLoaded event handler

[code]
if(myCondition)
{
    var row = e.Row;
    Style style = new Style(typeof(GridViewRow));
    style.BasedOn = e.Row.Style;
     style.Setters.Add(new Setter(GridViewRow.BackgroundProperty, new SolidColorBrush(Colors.Orange)));
     style.Setters.Add(new Setter(GridViewRow.ForegroundProperty, new SolidColorBrush(Colors.Green)));

}
[/code]
The Foreground color is set correctly but nothing happens to the Background color. Am I missing something?

3 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 25 Feb 2016, 01:43 PM
Hello,

Please refer to your other forum thread on the same question - Change Row Background color based on

Regards,
Yoan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
farizvi
Top achievements
Rank 1
answered on 25 Feb 2016, 01:55 PM

Hi!

Thanks for your response. Isn't it possible without overriding SelectStyle?

0
Yoan
Telerik team
answered on 25 Feb 2016, 03:15 PM
Hi,

Generally, it is not recommended to work with the visual elements directly. This is why I had suggested the use of StyleSelector. Please check the Styling or content mixed-up on scrolling help article for a reference.

Regards,
Yoan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
farizvi
Top achievements
Rank 1
Answers by
Yoan
Telerik team
farizvi
Top achievements
Rank 1
Share this question
or