Search code examples
wpfwpfdatagrid

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?


Solution

  • Set DataGrid's HeadersVisibility property to None

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