Articles in this section

How to create the diagonal line with header in WPF DataGrid?

In WPF DataGrid (SfDataGrid), a diagonal line can be added to a column header by using the HeaderTemplate property. This can be achieved by creating a custom DataTemplate and assigning it to the HeaderTemplate.

<syncfusion:GridTextColumn HeaderText="Order ID" 
                           MappingName="OrderID">
    <syncfusion:GridTextColumn.HeaderTemplate>
        <DataTemplate>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" 
                           Text="Value1" 
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"/>
                <TextBlock Grid.Row="1" 
                           Text="Value2" 
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"/>
                <Line Grid.RowSpan="2" X1="150" Y1="0" X2="0" Y2="90" 
                      Stroke="Black"  
                      StrokeThickness="2"/>
            </Grid>
        </DataTemplate>
    </syncfusion:GridTextColumn.HeaderTemplate>
</syncfusion:GridTextColumn>

Imagenew.png

Take a moment to peruse the WPF DataGrid - HeaderTemplate documentation, where you can find about customization of particular column header with code examples.

View sample in GitHub

Conclusion

I hope you enjoyed learning how to create the diagonal line with header in WPF DataGrid.

You can refer to our WPF DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WPF DataGrid example to understand how to create and manipulate data.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion, try our 30-day free trial to check out our other controls.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied