Nir Hasson
Topic Author
Posts: 71
Joined: 10 Nov 2013, 21:20
Contact:

Toggle Visiblity of List View Column

03 Feb 2014, 13:39

I have a ListView with couple of pre-defined columns.
Each column displays it's own custom template using the CellTemplate property.
During the application runtime I have to show/hide some columns depending on real time data I'm getting.

How can I accomplish this task ?
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Toggle Visiblity of List View Column

03 Feb 2014, 19:10

The easiest way of hiding a ListView Column is setting its GridViewColumn definition Width to 0.
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="0"/>
If you want to handle this from a MVVM perspective, you can use attached properties as explained here: http://wickedflame-dev.blogspot.com.es/ ... um-of.html

Who is online

Users browsing this forum: Semrush [Bot] and 18 guests