WPF Toolkit DataGrid, ColumnHeader Style and Blend
I’ve spent the better part of the day trying to figure out how to style the column headers of my WPF Toolkit datagrid through Microsoft Blend. Blend is a great tool and I couldn’t imagine trying to do a WPF application without it; however it is still immature and this could be why I found it so difficult to figure out. It could just be that I’m new to Blend, WPF, and XAML and still have a lot to learn.
I’ll spare you the agony I suffered this morning and jump right into the solution.
We have a pretty basic style for the datagrid at the moment. You’ll have to forgive the visual obfuscation.

Changing the the column header style looked pretty obvious in Blend. The menu walks me through the steps to create a resource for the header style.

Give the style resource a name. In this case I am going to show a pivoted set of data with a set of frozen columns on the left and columns that accept entering data on the right. I give it the name I want and choose its destination.

When the steps are complete, I have a style in the resources dictionary for my window, but something is missing.


<Style x:Key="EnterableColumnHeaderStyle"/>
The examples I’ve been seeing have a TargetType property to allow for the attached properties to work properly. I got ahead and add my TargetType property.

As you can see, I’m still learning WPF and XAML. ReSharper steps in and offers to help out a bit. I am glad to let it. It adds the proper namespace to the resource:
It also creates the namespace directive:
I don’t really like the namespace alias, so we’ll change it with the help of ReSharper.
Blend now knows our target type and gives us all the properties we could want to style.
![]()
We can do whatever we want with the column header now.
And, just as we’d expect, we get our new style.
We can also apply a style to a particular column.
<wpfToolkit:DataGridTextColumn x:Name="FirstColumn" Header="Something" HeaderStyle="{StaticResource FrozenColumnHeaderStyle }" >
















