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

Set backroundcolor of all GridView

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivo
Top achievements
Rank 1
Ivo asked on 10 May 2019, 09:29 AM

I want to set BackgroundColor of  all cells in the GridView dependent not on the propery of the RowItem but on the property bound to whole GridView.

The Bound Property is Called but nothing is changed. What is the easiest way to do it?

 

                <telerik:RadGridView.Style>
                  <Style TargetType="telerik:RadGridView">
                    <Style.Triggers>
                      <DataTrigger Binding="{Binding IsAuthenticated}" Value="True">
                        <Setter Property="Background" Value="{StaticResource W Grey}"/>
                      </DataTrigger>
                      <DataTrigger Binding="{Binding IsAuthenticated}" Value="False">
                        <Setter Property="Background" Value="{x:Null}"/>
                      </DataTrigger>
                    </Style.Triggers>
                  </Style>
                </telerik:RadGridView.Style>

 

Is it something bad here?

 

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 15 May 2019, 08:13 AM
Hi Ivo,

The provided style is targeting RadGridView. To change the Background of the cells you can create a custom style which targets GridViewCell. My guess is that the IsAuthenticated is a custom property. To bind to it you can use RelativeSource in the DataTrigger Binding. Check the attached project which demonstrates this approach.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Ivo
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or