title: CollectionViewSource Filter a Collection view with a list of items
body: <p>i will try to explain my problem best i can,
  i have my collection view:</p>
  <pre><code> CollectionViewSource ArticoliProduzioneViewSource;
  </code></pre>
  <p>that need to be filtered by 3 list of items</p>
  <pre><code> public ObservableCollection&lt;BLL.Models.Serie&gt; ListaSerie { get; set; } = new ObservableCollection&lt;BLL.Models.Serie&gt;();  
  
   public ObservableCollection&lt;BLL.Models.Prodotto&gt; ListaProdotti { get; set; } = new ObservableCollection&lt;BLL.Models.Prodotto&gt;();
  
   public ObservableCollection&lt;BLL.Models.Colore&gt; ListaColori { get; set; } = new ObservableCollection&lt;BLL.Models.Colore&gt;();
  </code></pre>
  <p><a href="https://i.stack.imgur.com/pX5Kj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pX5Kj.png" alt="enter image description here" /></a></p>
  <p>this is the screen of what i need to do, only to let you understand, i need to filter the items inside the first datagrid(the collectionviewsource) with the items in the 3 smaller datagrids (the 3 observablecollections that i have figured before)</p>
  <pre><code>    private void CollectionViewSource_Filter(object sender, FilterEventArgs e)
      {
          e.Accepted = 
          (ListaSerie.Count != 0 ? ((BLL.Models.ArticoloProduzione)e.Item).ArticoloSerieProdotto.Serie.Id == Serie.Id : true)
          &amp;
          (ListaProdotti.Count != 0 ? ((BLL.Models.ArticoloProduzione)e.Item).ArticoloSerieProdotto.Prodotto.Id == Prodotto.Id : true)
          &amp;
          (ListaColori.Count != 0 ? ((BLL.Models.ArticoloProduzione)e.Item).Colore.Id == Colore.Id : true)
          ;
  
      }
  </code></pre>
  <p>this is what i tried, it works, but it filters the main collectionview only with the last
  item that i have inserted in one of the 3 filter list.</p>
  <p>what i need to do here is just to filter the main CollectionView with all the items that
  are included in the 3 observable collections that i use as filters.
  hope you understand, thank you!</p>