We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridHeaderCellControl override Style basedon

Thread ID:





127595 Nov 26,2016 02:18 PM UTC Nov 28,2016 05:24 PM UTC WPF 2
Tags: SfDataGrid
Marcus Scholle
Asked On November 26, 2016 02:18 PM UTC

Hey there,

so I'm looking for a way to override the style for a ColumHeader in SfDataGrid while maintain all other properties from the default style.
For regular MS controls, this is quite easy however I struggle to find out how to achieve this with your own controls.

The documentation doesn't really help me with that as the default style is overwritten as it is:

Technically I would like to write something like this:

            <Style TargetType="syncfusion:GridHeaderCellControl" x:Key="headerStyle" BasedOn={StaticResource MetroGridHeaderCellControlStyle}">
                <Setter Property="FontSize" Value="20"/>

However this way I'm getting an error that the resource couldn't be resolved. I assume because the ressources are named differently for SF controls.

Marcus Scholle
Replied On November 26, 2016 04:20 PM UTC

Was able to resolve it on my own.

For reference:
In resources

            <DataTemplate x:Key="SfGridDefaultHeader">
                <TextBlock FontSize="26" Foreground="Red" Text="{Binding}"/>

For the control

             <syncfusion:GridTextColumn HeaderText="Test1" HeaderTemplate="{StaticResource SfGridDefaultHeader}"/>

This leaves all the other functions (Mouseover highlighting e.g.) intact.

Srinivasan Vasu [Syncfusion]
Replied On November 28, 2016 05:24 PM UTC

Hi Marcus, 
Thanks for contacting Syncfusion support. 
We cannot understand your query clearly. Based on your query we suspect you need to edit the GridHeaderCellControl style with MouseOver states. We prepared a sample on the same and you can download the same from below location. 
To edit the GridHeaderCellControl complete template please refer link. 
If you want to load different control other than TextBlock, you can use HeaderTemplate. Please refer the below UG link to refer load DataTemplates. 
If your requirement doesn’t meet with above solutions, please let us know more details about your requirement. That would more helpful for us to serve you better. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon