I have several listviews with two collumns like.
I am building a stats application for another application.
Each row should have two columns.
(Name,Sum) or (Name,Count)
The problem is that the model has three(Name,Sum,Count).And i want to have a general switch to determine which column should be shown at all 6 listviews. Is there any solution for this?
I have several listviews with two collumns like. I am building a stats application
Share
You could use a style for the ListView and only add the columns that you want depending on a property that shows which view you’re after.
CountSumSwitch is a boolean dependency property that I have in MainWindow, you switch it to true to display the counts in all listviews and false to display the sum in all listviews.
Edit:
To show this in action I’ll add an example, it shows a listview bound to a collection with a checkbox to toggle the columns that are used. Create a new WPF application, replace the MainWindow class with this
And put this code in the MainWindow.xaml