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

Background header

4 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pan hal
Top achievements
Rank 1
Pan hal asked on 17 May 2010, 09:30 PM
How to change the background color of Grid header. We need to set this color in resource dictionary.

Can some one help here

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 18 May 2010, 06:54 AM
Hi Pan hal,

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.
0
Pan hal
Top achievements
Rank 1
answered on 18 May 2010, 10:49 PM


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>

0
Accepted
Maya
Telerik team
answered on 19 May 2010, 12:12 PM
Hello Pan hal,

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.
0
Pan hal
Top achievements
Rank 1
answered on 20 May 2010, 09:10 PM

Thanks. It helped me. Marked as answer
Tags
GridView
Asked by
Pan hal
Top achievements
Rank 1
Answers by
Milan
Telerik team
Pan hal
Top achievements
Rank 1
Maya
Telerik team
Share this question
or