WPF

WPF ListView – Hide Column Headers by simple Style

WPF ListView is a very popular tool for showing list of items. Sometimes we need to hide the ListView column headers and only show the list of items.

But ListView does not provide any default behavior or property for hiding the column headers.

By applying a simple style you can hide the column headers of WPF ListView.

<Grid>
	<ListView x:Name="ListView1">
		<ListView.Resources>
			<Style TargetType="GridViewColumnHeader">
				<Setter Property="Visibility" Value="Collapsed" />
			</Style>
		</ListView.Resources>
		<ListView.View>
			<GridView>
				<GridView.Columns>
					<GridViewColumn DisplayMemberBinding="{Binding ID}" />
					<GridViewColumn DisplayMemberBinding="{Binding Name}" />
				</GridView.Columns>
			</GridView>
		</ListView.View>
	</ListView>
</Grid>

In the line 4, I have created a simple style with TargetType to ‘GridViewcolumnHeader’ and set the GridViewColumnHeader visibility to collapsed.

This style is automatically applied to every GridViewColumnHeader used in the ListView and hides the column headers of every ListView column.

WPF Hide ListView ColumnHeader