How to save the IsExpanded state in group headers of a listview

前端 未结 3 847
不思量自难忘°
不思量自难忘° 2020-12-03 03:18

I have quite a tricky problem:

I am using a ListView control with the ItemsSource set to a CollectionViewSource including a PropertyGroupDescription to group the Lis

3条回答
  •  自闭症患者
    2020-12-03 04:20

    The marked Answer Doesn't work in .Net 4.5.

    A simple solution for this is to add a

        private bool _isExpanded = true;
        public bool IsExpanded
        {
            get { return _isExpanded; }
            set { _isExpanded = value; }
        }
    

    property to your ViewModel (In this case Whatever objects CurrentListViewData holds)

    and then do:

    
    

    on your template.

    Simple and effective just like WPF should be

提交回复
热议问题