Styling Header Row

3 posts, 1 answers
  1. farizvi
    farizvi avatar
    8 posts
    Member since:
    Feb 2007

    Posted 31 Aug 2015 Link to this post

    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. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 31 Aug 2015 Link to this post

    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
  3. DevCraft banner
  4. farizvi
    farizvi avatar
    8 posts
    Member since:
    Feb 2007

    Posted 31 Aug 2015 in reply to Ivan Ivanov Link to this post

    Thanks a lot Ivan.

    Your suggestion has helped me resolve the issue.

Back to Top