RadGridView - background

3 posts, 0 answers
  1. Bartosz
    Bartosz avatar
    2 posts
    Member since:
    Dec 2014

    Posted 05 Oct 2016 Link to this post


    I'm trying to change background colour for cells with value = "NO".

    I found in one of the demo example this code: 

    <telerik:StyleRule Condition="UnitPrice > 10">
        <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellStyle}">
                <Setter Property="Background" Value="{telerik:Windows8Resource ResourceKey=AccentBrush}" />
                <Setter Property="Foreground" Value="{telerik:Windows8Resource ResourceKey=MainBrush}" />


    Could I use StyleRule and Condition for string values like below ?

    <telerik:StyleRule Condition="MyColumn = 'YES' ">

    It doesn't work for me ...


  2. Bartosz
    Bartosz avatar
    2 posts
    Member since:
    Dec 2014

    Posted 07 Oct 2016 in reply to Bartosz Link to this post

    Can I use "StyleRule and Condition" in XAML directly or StyleSelector is a right way for that ?

    Thank you for tips !

  3. Stefan
    Stefan avatar
    1073 posts

    Posted 07 Oct 2016 Link to this post

    Hi Bartosz,

    The out-of-the-box mechanism of RadGridView for meeting such requirement is to use the CellStyleSelector.

    You can also take a look at the StyleSelectors section of the online examples of the control. The same ones can be found in the local copy of the WPF Demos.

    I hope you find these resources helpful.

    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top