Alex Rivera | Logout

Hide the column of wpf listview

Asked 2009-05-05T07:47:39.173
9

how to make column invisible of wpf listview? (one way is to set width property to minimum lenth but that not proper solution) can anyone help me?

Edit
Report

2 Answers

8

There is a pretty simple explanation of one way of doing it here.

Find and remove your column:

var temp = myGridView.Columns[0];
myGridView.Columns.RemoveAt(0);

Insert the column back in the view:

myGridView.Columns.Add(temp );
temp.Width = 0;
temp.Width = Double.NaN;

Remove it from the columns collection when you want to hide it and reinsert the column when you want to display it again.

answered 2009-05-05T08:37:25.000
0

To hide the header of a ListView you can modify 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>

answered 2009-09-08T11:42:39.587

Your Answer