WPF ListView Selecting Multiple List View Items

前端 未结 5 2084
故里飘歌
故里飘歌 2021-02-07 12:21

I am figuring out a way to Select Multiple items in list view and deleting them on a certain action. What I can\'t figure out is, how should I have these multiple items selected

5条回答
  •  广开言路
    2021-02-07 12:38

    I would suggest do not use the SelectedItems property of ListView, instead bind the Selected property of the single ListViewItem, to a corresponding ViewModel class. After this, the only thing you need to do is to find all ViewModel object that have bound the Selected property TRUE, remove them from model collection (if you do remove) and refresh UI. If the collection is ObservableCollection, the UI will be refreshed automatically. Good Luck.

提交回复
热议问题