Dynamically change cell background color when using conditional styles

5 posts, 0 answers
  1. Brian
    Brian avatar
    19 posts
    Member since:
    Aug 2010

    Posted 04 Oct 2010 Link to this post

    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.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 07 Oct 2010 Link to this post

    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
  3. DevCraft banner
  4. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 23 Nov 2010 Link to this post

    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.
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 25 Nov 2010 Link to this post

    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
  6. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 25 Nov 2010 Link to this post

    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)
Back to Top
DevCraft banner