9 Answers, 1 is accepted
For achieving this, you may modify the template of GridViewHeaderCell and remove the Border element with x:Name=Background_Over.
Please check the Override Default RadGridView Styles article for further reference.
Best Regards,
Stefan
Telerik
Hello Stefan,
Thanks for your replay, My question is remove the mouse over color in WPF RadGridView column Header?
Thanks,
Bennit.
Please excuse me for this misunderstanding.
You actually need to remove the Border element with x:Name="GridViewHeaderCell_Over". It is located within the ControlTemplate with x:Key="GridViewHeaderCellTemplate" in Telerik.Windows.Controls.GridView.xaml file.
Hope this helps.
Regards,
Stefan
Telerik
Hi Stefan,
Thanks for your guide, Here I have post my code, but I can't remove the mouse over color from column header, so please check this code and help me... I am waiting for your replay.
<telerik:GridViewDataColumn HeaderCellStyle="{StaticResource GridViewHeaderRowStyle1}" DataMemberBinding="{Binding Name}" Header="Name"></telerik:GridViewDataColumn>
<Style x:Key="GridViewHeaderRowStyle1" TargetType="{x:Type telerik:GridViewHeaderCell}">
<Setter Property="Background" Value="#368087"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="BorderThickness" Value="0 0 0 0"/>
<Setter Property="Template">
<Setter.Value> <ControlTemplate TargetType="telerik:GridViewHeaderCell">
<Border x:Name="GridViewHeaderCell_Over" BorderBrush="Red" BorderThickness="1" Grid.ColumnSpan="2" Opacity="0">
<Border Cursor="Hand" BorderBrush="Red" BorderThickness="0" Background="Red"/> </Border>
<ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red" />
<Setter Property="BorderBrush" Value="Red" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Thanks,
Bennit.
What I meant in my previous post was to modify the default template of the control. The suggested approach in my previous post includes searching through the style file for the particular Telerik theme. the style files for all Telerik thems can be found in the Themes folder of your personal installation. Please check the Setting a Theme(Using Implicit Styles) topic for further reference.
Another approach would be to use MS Expression Blend as described in the Styling RadGridView article. You might also take a look at the Styling Column Headers article.
Hope this helps.
Best Regards,
Stefan
Telerik
Hi Stefan,
Can you pls look at this code and let me know why Remove MouseOver color in Gridview Column Header in not working?
<telerik:GridViewDataColumn DataMemberBinding="{Binding EntityName}" HeaderCellStyle="{StaticResource GridViewHeaderStyle}" Header="Entity Name" IsReadOnly="True"/>
<Style x:Key="GridViewHeaderStyle" TargetType="{x:Type telerik:GridViewHeaderCell}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="BorderThickness" Value="0 0 0 0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:GridViewHeaderCell">
<Border x:Name="GridViewHeaderCell_Over" BorderThickness="0" Grid.ColumnSpan="2" Opacity="0">
<Border Cursor="Hand" BorderBrush="Red" BorderThickness="0" Background="Red" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="False" />
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Much Thanks
I am attaching a sample application which demonstrates how to modify the template of GridViewHeaderCell, so that the mouse over GridViewHeaderCell_Over to be removed.
Hopefully, this helps.
Regards,
Stefan X1
Telerik by Progress
Stefan,
I ran the .sln you attached to see how it works but it displayed blank window (see attached). I'm fairly new to this WPF but the Style code defined in the example seems lengthy just for removing the color change on header mouseover. Is there a precise way to do it? Also noticed that telerik:RadGridView in the example is not applying the Style defined.
Thanks,
Srinu
Thanks for the image provided.
From it I assume that you have applied NoXAML binaries. If this is the case, you need to also merge the needed theme files. Please, take a look at the Implicit Styles topic for a detailed explanation of this topic.
As to your other questions. The built-in mechanism provided by the framework for modifying the template of a control is the one demonstrated in the previously attached sample project. I am afraid, that I cannot provide an alternative. Also, the Style defined is not applied to RadGridView, as it is an implicit one. I suggest you reviewing the Using WPF Styles topic for more information on this matter.
I hope you find these resources helpful.
Best Regards,
Stefan X1
Telerik by Progress