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

Remove MouseOver color in Gridview Column Header

9 Answers 1186 Views
GridView
This is a migrated thread and some comments may be shown as answers.
bennit
Top achievements
Rank 1
bennit asked on 27 May 2015, 07:41 AM

Hi Peshito,

I have one more question,  how to remove the "MouseOver" color in RadGridView column Header? please help me

Regards,

Bennit.

9 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 29 May 2015, 03:35 PM
Hello Bennit,

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
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
0
bennit
Top achievements
Rank 1
answered on 04 Jun 2015, 08:01 AM

Hello Stefan,

Thanks for your replay, My question is remove the mouse over color in WPF RadGridView column Header?

Thanks,

Bennit.

0
Stefan
Telerik team
answered on 05 Jun 2015, 10:30 AM
Hi 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
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
0
bennit
Top achievements
Rank 1
answered on 07 Jun 2015, 04:43 PM

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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0
Stefan
Telerik team
answered on 09 Jun 2015, 04:11 PM
Hello 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
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
0
Srinu
Top achievements
Rank 1
answered on 21 Nov 2016, 08:45 PM

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

0
Stefan
Telerik team
answered on 23 Nov 2016, 01:34 PM
Hello Srinu,

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
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Srinu
Top achievements
Rank 1
answered on 23 Nov 2016, 03:28 PM

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

0
Stefan
Telerik team
answered on 24 Nov 2016, 11:11 AM
Hi 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
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
bennit
Top achievements
Rank 1
Answers by
Stefan
Telerik team
bennit
Top achievements
Rank 1
Srinu
Top achievements
Rank 1
Share this question
or