Changing the row background through bindings

3 posts, 0 answers
  1. Jose Simas
    Jose Simas avatar
    35 posts
    Member since:
    Mar 2009

    Posted 21 Sep 2010 Link to this post


    In my GridView I need to change the background of certain rows depending on one property of the object bound to that row. I found the forum thread below which explains how to do it but as soon as I change the references on the examples posted to the latest version of the GridView it does not compile. Would you please update the example or point me to another solution?

    Best Regards,
    Jose Simas
  2. Jose Simas
    Jose Simas avatar
    35 posts
    Member since:
    Mar 2009

    Posted 22 Sep 2010 Link to this post

    This is actually quite easy to do but I lost a couple of hours looking for the solution so I thought I would post here the answer.

    <telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="True" Name="radGridView1">
            <Style TargetType="{x:Type GridView:GridViewRow}">
                    <DataTrigger Binding="{Binding MyFlag}" Value="True">
                        <Setter Property="Background" Value="LightBlue"/>
                        <Setter Property="Foreground" Value="Black"/>
  3. DevCraft R3 2016 release webinar banner
  4. Vanya Pavlova
    Vanya Pavlova avatar
    2019 posts

    Posted 22 Sep 2010 Link to this post

    Hello Jose Simas,

    You can also use Conditional Styles and Templates for RadGridView-WPF/SL.
    Other than that using DataTriggers is probably the most straightforward way to go.

    All the best,
    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
Back to Top