This is a migrated thread and some comments may be shown as answers.
Dynamically change cell background color when using conditional styles
4 Answers 233 Views
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 04 Oct 2010, 04:45 PM
We followed the example given for changing the cells background color using conditional formating. How can we change the background color dynamically via code? Each user can set this value in their profile and we need it to change per their profile.

This is the styles we use:

<local:DateConverter x:Key="dateconverter"></local:DateConverter>
<Style x:Key="UpperLimitStyle" TargetType="telerik:GridViewCell">
    <Setter Property="Background" Value="Red" />
</Style>
<Style x:Key="LowerLimitStyle" TargetType="telerik:GridViewCell" >
    <Setter Property="Background" Value="Yellow" />
</Style>
<Style x:Key="NormalStyle" TargetType="telerik:GridViewCell" >
</Style>

So we want to change the "Red" from the c# code behind page.

Thanks in advanced for the help.

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 07 Oct 2010, 10:27 AM
Hello Brian,

Please see the following article Conditional Styles And Templates for RadGridView Silverlight/WPF.
If you need any additional information please let me know.

Greetings,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Jonx
Top achievements
Rank 2
answered on 23 Nov 2010, 12:11 PM
Hello Vanya,
This seems only to allow to set the style at loading.
How can I update the style afterwards? for example, I want to change the color of the row depending on the values of my item.
One of the field is a checkbox. When I check or uncheck it the color of my row should be updated...
Any hint?
thank you...
John.
0
Vanya Pavlova
Telerik team
answered on 25 Nov 2010, 01:27 PM
Hi John,


What version of RadGridView you are currently using? In our Q3 release the issue is resolved and the StyleSelector's are applied automatically since the INotifyPropertyChanged interface is implemented.
If you are using any other version I would recommend you to explicitly call RagGridView's Rebind method to reapply the StyleSelector.


All the best,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Jonx
Top achievements
Rank 2
answered on 25 Nov 2010, 01:35 PM
Hello Vanya,
You are right Q3 builds solve the issue perfectly.
Thank you very much.

(http://www.telerik.com/community/forums/silverlight/gridview/styleselector-does-not-get-called-gridrow-updated.aspx)
Asked by
Brian
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Jonx
Top achievements
Rank 2
Share this question
or