4 Answers, 1 is accepted
RadGridView has a HeaderRowStyle property which allows you to provide custom style for the grid header. For example:
<
telerik:RadGridView
Name
=
"playersGrid"
Grid.Row
=
"1"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.HeaderRowStyle
>
<
Style
TargetType
=
"gridView:GridViewHeaderRow"
>
<
Setter
Property
=
"Background"
Value
=
"Green"
/>
</
Style
>
</
telerik:RadGridView.HeaderRowStyle
>
</
telerik:RadGridView
>
Kind regards,
Milan
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
Nope it didnot work. first of all I need to set this resource dictionary as this property needs to be set all the Radgrids in the app.
Anyways I tried this below one and I get the error .Can you please tell me whats the fix for this.
xmlns :telrikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
xmlns :telrikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
Title="Total Page">
<Grid x:Name="grdLayoutRoot" Margin="0" ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<tkGrid:RadGridView x:Name="grdAssignments" AutoGenerateColumns="False" Grid.Row="1" Margin="-7,0,-7,10" ShowColumnFooters="False" RowIndicatorVisibility="Collapsed" Style="{StaticResource Style_radGridView}"
ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollMode="RealTime">
<telerik:RadGridView.HeaderRowStyle>
<Style TargetType="gridView:GridViewHeaderRow">
<Setter Property="Background" Value="Green"/>
</Style>
</telerik:RadGridView.HeaderRowStyle>
<tkGrid:RadGridView.Columns>
<tkGrid:GridViewDataColumn Header="Total" Background="WhiteSmoke" IsResizable="False"/>
<tkGrid:GridViewDataColumn Header="Detail" Background="WhiteSmoke" IsReadOnly="True"/>
<tkGrid:GridViewDataColumn Header="Time" Background="WhiteSmoke" IsReadOnly="True" />
</tkGrid:RadGridView.Columns>
</tkGrid:RadGridView>
I am sending you a sample project that applies styles for GridViewHeaderRow and GridViewHeaderCell and they are both defined in the Resource Dictionary, thus enabling you to use them on every grid you want.
I hope that helps.
Best wishes,
Maya
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
Thanks. It helped me. Marked as answer