I create a public CollectionView (cvs) and bind that to my ListView Control in a WPF application. Then there are a series of filters that add in delegates to filter my cvs object. Everything works fine in this aspect of the program.
public ICollectionView cvs { get; set; }
public ObservableCollection<T> TLIST
...
cvs = CollectionViewSource.GetDefaultView(TLIST);
ListViewName.ItemsSource = cvs;
...
//Filters created
cvs.Filter = groupFilter.Filter;
What I'm trying to do is create Excel files of the items in my list. I can send the entire collection (TLIST) to an OpenXML function and create my files just fine. Where I'm struggling is I want to only send the filtered items into the function and figure I need to somehow send the filtered cvs.
In short, what I'm trying to get is --> cvs.ToList()
but this is not a valid operation. and getting the error
"Unable to cast object of type 'System.Windows.Data.ListCollectionView' to type 'System.Collections.Generic.List`1"
Anything glaringly obvious that I'm doing wrong? Any guidance is appreciated.
Note: Even when I inspect cvs it shows all the items not just the filtered ones.