Cesar Coll
Cesar Coll

Reputation: 125

How do I COMPLETELY remove the header of a datagrid in wpf?

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

Answers (2)

Nitesh
Nitesh

Reputation: 7409

Set the HeadersVisibility property for DataGrid

<DataGrid HeadersVisibility="Row"></DataGrid>

or

<DataGrid HeadersVisibility="None"></DataGrid>

Upvotes: 1

Kapit&#225;n Ml&#237;ko
Kapit&#225;n Ml&#237;ko

Reputation: 4538

Set DataGrid's HeadersVisibility property to None

<DataGrid HeadersVisibility="None">
<!-- WHATEVER YOU WANT HERE -->
</DataGrid>

Upvotes: 6

Related Questions