Page 1 of 1

Toggle Visiblity of List View Column

Posted: 03 Feb 2014, 13:39
by Nir Hasson
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 ?

Re: Toggle Visiblity of List View Column

Posted: 03 Feb 2014, 19:10
by sfernandez
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