Filterset from WPF CollectionViewSource

426 views Asked by At

How do you get the resultset from the CollectionViewSource once it's filtered? Actually, all I need is the count, but I assume sure the answers go together. Thanks!

1

There are 1 answers

3
Aaron McIver On BEST ANSWER

collectionViewSource.View returns the active view. Therefore once the filtering is complete the collectionViewSource.View would represent the items which returned true during the filter. If you wanted the entire underlying collection for whatever reason you would access that via collectionViewSource.View.SourceCollection.

int count = 0;

  IEnumerable items = collectionViewSource.View;
  foreach (var item in items)
      count++;