none
Hide Listview Column

    Question

  • Hello,

    Is it possible to hide a listview column? I don't want to remove it, and I want to process the data in it. I just want to hide it. 

    Is this possible to do? I tried setting the width of the column to "0" and it doesnt show up in the listview. But If I try to resize the columns its seen very easily.
    I just need the value from that column. Cn Tag property be helpful ?

    Please help.
    - Manju

    Thanks,

    Wednesday, June 17, 2009 7:47 PM

Answers

  • First off, it is not a good practice forcing a control to draw content and then permanently hiding it just because u wanna use the contents for calculation. I assume that you are using a GridView inside ListView.View. Your best solution would be to just take the collection you r binding the ListView to, and create a secondary just for displaying purposes (e.g. to bind it to the ListView) or better yet bind the ListView to a view of your original collection, filtered down to only the collumns you need.

    Alternativle you can obtain the wpftoolkit, developed by the Microsoft people, from codeplex here :http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25047 (installation is super easy) and use the datagrid control that is provided which would give you that (plus a lot more) extra functionality when representing tabular data.

    Hope I helped.
    Thursday, June 18, 2009 9:36 AM
  • Hi,

    What GNS1 posted above really said the point in this scenaro. It does not make much sense to hide a UI element for just hold the content for your calculation purpose. If you really want the content of the column content, you can use other ways to achieve it. here is a akin post to hide the columns in ListView and disable the Column header resizing functionality:
    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5ff5b928-2259-42b8-9f56-733bc9672742

    Hope this helps.
    Thanks.


    Jim Zhou -MSFT
    Wednesday, June 24, 2009 10:06 AM

All replies

  • First off, it is not a good practice forcing a control to draw content and then permanently hiding it just because u wanna use the contents for calculation. I assume that you are using a GridView inside ListView.View. Your best solution would be to just take the collection you r binding the ListView to, and create a secondary just for displaying purposes (e.g. to bind it to the ListView) or better yet bind the ListView to a view of your original collection, filtered down to only the collumns you need.

    Alternativle you can obtain the wpftoolkit, developed by the Microsoft people, from codeplex here :http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25047 (installation is super easy) and use the datagrid control that is provided which would give you that (plus a lot more) extra functionality when representing tabular data.

    Hope I helped.
    Thursday, June 18, 2009 9:36 AM
  • Hi,

    What GNS1 posted above really said the point in this scenaro. It does not make much sense to hide a UI element for just hold the content for your calculation purpose. If you really want the content of the column content, you can use other ways to achieve it. here is a akin post to hide the columns in ListView and disable the Column header resizing functionality:
    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5ff5b928-2259-42b8-9f56-733bc9672742

    Hope this helps.
    Thanks.


    Jim Zhou -MSFT
    Wednesday, June 24, 2009 10:06 AM