Is ICollectionView supported by .NET 6 or is there an alternative for filtering lists in MVVM?

325 views Asked by At

I’m writing a WPF app using MVVM, entity framework and .NET 6. I have a list view control in my View that I want to bind to a collection in my corresponding View Model. I want to be able to filter the list view items based on multiple text boxes and checkbox selections. Each list view item represents a domain object with several properties. I have seen lots of videos easily achieving filtering via System.ComponentModel.ICollectionView. However, I’m not seeing this class in the namespace when using .NET 6. Has it been ditched? Seems a useful class and I can’t imagine it being dropped without an alternative. MS docs api doesn’t list core or .NET 5 or 6 in the Applies To section but one YouTuber has said that he has the class in his .NET 6 solution.

1

There are 1 answers

1
Roy On

Problem solved. Thank you for your replies which confirmed to me that it was a config issue rather than the class being left out of .NET 6. Interestingly if you go to the docs api link posted by @ibrennan208 and scroll down to the Applies To section, it only lists framework versions which made me wonder if ditched. Realising I could see the class from my View’s code behind in my wpf project reassured me it was a config issue. The View Model in which I wanted to use the class was in my assembly project. The fix: add UseWPF tag and set to true in assembly project’s PropertyGroup tag