Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the Column header in a WPF DataGrid?

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?

like image 343
Ubalo Avatar asked Jul 02 '09 18:07

Ubalo


People also ask

How to hide grid Row in WPF?

Simply do this: rowToHide. Height = new GridLength(0);


2 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" 
like image 156
Vic Avatar answered Sep 21 '22 16:09

Vic


Both DataGrid of namespace System.Windows.Controls and WpfToolkit:DataGrid of Microsoft.Windows.Controls have the property

HeadersVisibility="None" 

In the properties window of DataGrid you can indeed choose from the available options

None Column Row All 

But this doesn't appear in the Properties window of WpfToolkit:DataGrid So as far as I know, you need to type that in inside your .xaml file.

<WpfToolkit:DataGrid HeadersVisibility="None">        ... </WpfToolkit:DataGrid> 

If you want I can post the whole UserControl. Is that useful ?

like image 25
HCP Avatar answered Sep 20 '22 16:09

HCP