title: Change ICollectionView source in MVVM
body: <p>My question is related to that <a href="https://stackoverflow.com/questions/10093579/changing-collectionviewsource-source-in-a-mvvm-world">post</a>, but I create a new post as the question is very old.</p>
  
  <p>I am beginning to use <code>ICollectionView</code>, so I made the ViewModel as the following :</p>
  
  <pre><code>public ICollectionView SampleListView { get; set; }
  SampleListView = new CollectionViewSource() { Source = SampleList }.View;
  </code></pre>
  
  <p>The problem is when I change the source, I used to do the following :</p>
  
  <pre><code>List&lt;T&gt; list= GetMyList();
  SampleList=new ObservableCollection&lt;T&gt;(list);
  </code></pre>
  
  <p>The accepted answer (by blindmeis) explains that there are two options to solve that issue :</p>
  
  <p>1) <em>Instead of replacing the ObservableCollection you can use .Clear() and add the items from the new Collection. This has the additional bonus of not breaking your grouping and sorting.</em></p>
  
  <p>2) *whenever you replace your ObservableCollection you have to create a new ICollectionView for sorting and grouping.</p>
  
  <pre><code>this._view = (ICollectionView)CollectionViewSource.GetDefaultView(this.MyCollection);
  </code></pre>
  
  <p>You can simply bind to your collection if you take the DefaultView</p>
  
  <p><code>&lt;DataGrid Name="grid" ItemsSource="{Binding MyCollection}" /&gt;</code></p>
  
  <p>My question is, what is the best way to do that? I mean the "clean" solution?</p>
  
  <p>For me the faster would be to use solution two(only because I have a big project with lot of ListViews, and would be a big work to take option 1).
  What are the advantages of taking the option 1? Is it worth it?(except keeping grouping/sorting).</p>