Remove MouseOver color in Gridview Column Header

10 posts, 0 answers
  1. bennit
    bennit avatar
    14 posts
    Member since:
    Aug 2014

    Posted 27 May 2015 Link to this post

    Hi Peshito,

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

    Regards,

    Bennit.

  2. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 29 May 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. bennit
    bennit avatar
    14 posts
    Member since:
    Aug 2014

    Posted 04 Jun 2015 in reply to Stefan X1 Link to this post

    Hello Stefan,

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

    Thanks,

    Bennit.

  5. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 05 Jun 2015 Link to this post

    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
  6. bennit
    bennit avatar
    14 posts
    Member since:
    Aug 2014

    Posted 07 Jun 2015 in reply to Stefan X1 Link to this post

    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.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  7. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 09 Jun 2015 Link to this post

    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
  8. Srinu
    Srinu avatar
    2 posts
    Member since:
    Nov 2016

    Posted 21 Nov in reply to Stefan X1 Link to this post

    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

  9. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 23 Nov Link to this post

    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.
  10. Srinu
    Srinu avatar
    2 posts
    Member since:
    Nov 2016

    Posted 23 Nov in reply to Stefan X1 Link to this post

    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

  11. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 24 Nov Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready