Hide list column wpf
There is a fairly simple explanation of one way to do this here .
Find and remove the column:
var temp = myGridView.Columns[0];
myGridView.Columns.RemoveAt(0);
Insert the column back into the view:
myGridView.Columns.Add(temp ); temp.Width = 0; temp.Width = Double.NaN;
Remove it from the Column Collection when you want to hide it and re-insert the column when you want to show it again.
source to share
To hide the title of the ListView, you can change the Visibility property of the ColumnHeaderContainer by overriding the style locally.
<ListView>
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style>
<Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridView.Columns>
...
</GridView.Columns>
</GridView>
</ListView.View>
source to share
I hope this helps someone:
The best way I have found is to do these two things:
1. Set the column width to 0 (this can also be done in the GridViewColumnHeader) - change it in the code if you want to show the column again.
2. Set the Visibility of the GridViewColumnHeader to Hidden - set it in code if you want to show the column again, or you can even use binding.
The second point above helps to make the column non-extensible by the user.
source to share
To hide a column, you can set the column width to zero and disable the header, like this:
Set the GridViewColumn Width and set the GridViewColumnHeader IsEnabled to False.
Example:
<GridViewColumn Width="{Binding ColumnWidth, Mode=OneWay}">
<GridViewColumnHeader Content="NΒΊ Item" IsEnabled="False" />
source to share