How to center or right align the Header in the WPF RadGridView by Telerik?

Telerik is not the best at providing documentation on how to do things, so I figured I would write some of the more mundane tasks that took me a few minutes thought.

Here, I needed to center my headers. It is easy but only if you know all the magic words. If you don’t, it is pretty hard.

Here is how you do it. A simple style.


        <telerik:RadTreeListView ItemsSource="{Binding Nodes}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                               IsExpandedBinding="{Binding IsExpanded,Mode=TwoWay}"                                 
                             SelectedItem="{Binding SelectedNode,Mode=TwoWay}"
                <Style BasedOn="{StaticResource {x:Type telerik:GridViewHeaderCell}}" TargetType="{x:Type  telerik:GridViewHeaderCell}">
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>

Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.