XAML:
<telerik:GridViewDataColumn Header="Type" Width="150" DataMemberBinding="{Binding TypeDisplay}" HeaderCellStyle ="{StaticResource raHeaderCellStyle}"/>
Style:
<Style x:Key="raGridViewHeaderCellControlTemplate" TargetType="telerik:GridViewHeaderCell">
<Setter Property="Background" >
<Setter.Value>
<SolidColorBrush Color="Blue" />
</Setter.Value>
</Setter>
</Style>
However, if I AutoGenerate columns I can't figure out how to set this cellheader style. Thanks.
8 Answers, 1 is accepted
You may subscribe to the AutoGeneratingColumn event of RadGridView to access auto-generated columns and set the corresponding HeaderCellStyle from there.
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

If you want this style to be applied to all GridViewHeaderCells you may mark this style as an implicit one and it will be applied to all elements of this type:
<
Style
TargetType
=
"telerik:GridViewHeaderCell"
>
<
Setter
Property
=
"Background"
>
<
Setter.Value
>
<
SolidColorBrush
Color
=
"Blue"
/>
</
Setter.Value
>
</
Setter
>
</
Style
>
You do not have to subscribe to this event for all columns. You should need to subscribe when you want to apply different header cell style for each column.
Greetings,
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Style:
<Style TargetType="telerik:GridViewHeaderRow">
<Setter Property="Background" >
<Setter.Value>
<SolidColorBrush Color="#FFF5F5FD" />
</Setter.Value>
</Setter>
</Style>
Indeed there is a problem related to the implicit style targeted at GridViewHeaderRow in a theme different than the default one. For the time being I may suggest you to refer this style explicitly through HeaderRowStyle attribite of RadGridView:
<
Window.Resources
>
<
Style
x:Key
=
"style1"
TargetType
=
"telerik:GridViewHeaderRow"
>
...
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
</
Style
>
</
Window.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
DataContext
=
"{Binding Source={StaticResource SampleDataSource}}"
>
<
telerik:RadGridView
HeaderRowStyle
=
"{StaticResource style1}"
telerik:StyleManager.Theme
=
"Metro"
Margin
=
"72,32,48,58"
ItemsSource
=
"{Binding Collection}"
/>
</
Grid
>
</
Window
>
I have logged this issue in our PITS System and you may track its progress here.
Furthermore I have already updated your Telerik points accordingly.
All the best,
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>


