0

I'd like to use the CollectionViewSource.GetDefaultView(). But the problem is that it always returns the same instance, but I need many of them since I need to attach different filters on different views.

Another problem is that CollectionViewSource.GetDefaultView() is [ThreadStatic]. I see no reason why consecutive calls to GetDefaultView() always returns the same instance, but on another thread it returns another instance.

Since always the same instance of the view is returned I cannot use the DefaultView. I tried to dig into the msdn source code, but there are too many internal function that I cannot use to create my own instances.

Any help?

msedi
  • 1,437
  • 15
  • 25
  • Did you read [msdn](https://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource.getdefaultview(v=vs.110).aspx) carefully? It's by design. Can you show what exactly are you doing (filters)? Using MVVM you may create different `ObservableCollection<>` in different VM from same `List<>` of model, that would allow you to apply different filters to collection in different views, while changes made to item are reflected in model. – Sinatr May 13 '16 at 08:04
  • 1
    http://stackoverflow.com/questions/16634194/wpf-multiple-collectionview-with-different-filters-on-same-collection – blindmeis May 13 '16 at 08:05

0 Answers0