Reputation:
Once I have filtered a CollectionViewSource
, is there a way to convert the result into an ObservableCollection
.
At present, I have used:
itemCount = _vm.DisplayItems.View.Cast<MyClass>().Count();
where DisplayItems
is a CollectionViewSource
, to count the number of items that have successfully passed through the filter.
I would like to get an ObservableCollection
of these items so that I can perform operations on them like Skip
and Take
etc.
Upvotes: 1
Views: 2602
Reputation: 22435
var l = _vm.DisplayItems.View.Cast<MyClass>().ToList();
and if you need a OberservableCollection
var c = new OberservableCollection<MyClass>(l);
Upvotes: 2