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

Styling Header Row

2 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
farizvi
Top achievements
Rank 1
farizvi asked on 31 Aug 2015, 07:28 AM

I am trying to change the theme of RadGridView's HeaderRow. I have followed the steps mentioned in the documentation and created a custom style in Blend. However, when I copy that style to my actual Silverlight project, that style is not applied. My style markup is given below

 

<SolidColorBrush x:Key="GridView_HeaderBackground" Color="#F6E0C1"/><br>    <SolidColorBrush x:Key="GridView_HeaderOuterBorder" Color="#F6E0C1"/><br>    <SolidColorBrush x:Key="GridViewHeaderCellDropMarkerPenBrush" Color="White"/><br>    <SolidColorBrush x:Key="GridView_HeaderForeground" Color="Black"/><br>    <Style x:Key="MyGridViewHeaderCellStyle" TargetType="telerik:GridViewHeaderCell">       <br>        <Setter Property="Background" Value="{StaticResource GridView_HeaderBackground}"/><br>        <Setter Property="BorderBrush" Value="{StaticResource GridView_HeaderOuterBorder}"/><br>        <Setter Property="BorderThickness" Value="0 0 0 0"/><br>        <Setter Property="VerticalContentAlignment" Value="Center"/><br>        <Setter Property="HorizontalContentAlignment" Value="Stretch"/><br>        <Setter Property="Padding" Value="5 0 3 0"/>       <br>        <Setter Property="Foreground" Value="{StaticResource GridView_HeaderForeground}"/><br>    </Style>

Am I missing something?

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Ivanov
Telerik team
answered on 31 Aug 2015, 01:02 PM
Hi,

The Style that you provided is has a Key value defined. It will be applied only on those control instances that explicitly refer their Style property to it  (ex. Style="{StaticResource MyGridViewHeaderCellStyle}"). I believe that you need to define an implicit style - one that only has a TagetType. In this way, it will be applied to all of the instances of the defiend type that fall into its resource scope. Here is a MSDN article that provides some more extensive information on styles.

Regards,
Ivan Ivanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
farizvi
Top achievements
Rank 1
answered on 31 Aug 2015, 01:12 PM

Thanks a lot Ivan.

Your suggestion has helped me resolve the issue.

Tags
GridView
Asked by
farizvi
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
farizvi
Top achievements
Rank 1
Share this question
or