WPF

How to Remove Row/Column Header in WPF DataGrid?

WPF DataGrid provides a HeadersVisibility property to hide Row Headers and Column Headers.

HeaderVisibility possible values are:

  1. All – Both row and column headers are visible.
  2. Row – Only row headers are visible and column headers are hidden.
  3. Column – Only column headers are visible and row headers are hidden.
  4. None – Both row and column headers are hidden.

HeadersVisibility – All

<DataGrid x:Name="myDataGrid" HeadersVisibility="All">
</DataGrid>

HeadersVisibility All

HeadersVisibility – Row

<DataGrid x:Name="myDataGrid" HeadersVisibility="Row">
</DataGrid>

HeadersVisibility Row

HeadersVisibility – Column

<DataGrid x:Name="myDataGrid" HeadersVisibility="Column">
</DataGrid>

HeadersVisibility Column

HeadersVisibility – None

<DataGrid x:Name="myDataGrid" HeadersVisibility="None">
</DataGrid>

HeadersVisibility None