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

RadGridView - background

2 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bartosz
Top achievements
Rank 1
Bartosz asked on 05 Oct 2016, 11:00 AM

Hi,

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}" />

    </Style>
</telerik:StyleRule>

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

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

It doesn't work for me ...

 

2 Answers, 1 is accepted

Sort by
0
Bartosz
Top achievements
Rank 1
answered on 07 Oct 2016, 07:00 AM

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

Thank you for tips !

0
Stefan
Telerik team
answered on 07 Oct 2016, 11:49 AM
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.

Regards,
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.
Tags
GridView
Asked by
Bartosz
Top achievements
Rank 1
Answers by
Bartosz
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or