How to hide the Column header in a WPF DataGrid?

Viewed 46524

I am using a DataGrid in Expression Blend but I just need to show only the registries and hide the ColumnHeader.

How do I do that?

3 Answers

In the DataGrid there is a Header section where the field Header Visibility could be set to None.

Or in xaml for the Datagrid add the property

HeadersVisibility="None"

This may be double posted, SO is being weird, but you can do this from code behind too.

C# code behind with a XAML datagrid named dg_Main would be:

dg_Main.HeadersVisibility = Microsoft.Windows.Controls.DataGridHeadersVisibility.None;

Doing this in code behind makes it easy to dynamically show and hide headers as needed.

Related