Reputation: 125
I need to remove the header of a WPF datagrid. I've tried:
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Height" Value="0"/>
</Style>
</DataGrid.Resources>
But that only changes the size of the content, but the grid still displays a row for the header.
How can I prevent DataGrid from displaying the header row entirely?
Upvotes: 3
Views: 1657
Reputation: 7409
Set the HeadersVisibility property for DataGrid
<DataGrid HeadersVisibility="Row"></DataGrid>
or
<DataGrid HeadersVisibility="None"></DataGrid>
Upvotes: 1
Reputation: 4538
Set DataGrid
's HeadersVisibility
property to None
<DataGrid HeadersVisibility="None">
<!-- WHATEVER YOU WANT HERE -->
</DataGrid>
Upvotes: 6