wpf collectionview multiple filter
<p>I need some advice. I have two ListViews first ListView is "ListViewAlbums" and the second "ListViewTracks".
 
Items in ListViewTracks are organized into groups.
ListViewAlbums is set SelectionMode = "Extended" and Behaviours: MultiSelectorBehaviours.SynchronizedSelectedItems.
<a href="https://github.com/samueldjack/SelectedItemsBindingDemo.git" rel="nofollow noreferrer">MultiSelectorBehaviours</a></p>

<p>When I select multiple items from ListViewAlbums, so I want to show all the items in ListViewTracks based ALBUMID.</p>

<p><a href="https://i.stack.imgur.com/i8hSv.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i8hSv.gif" alt="enter image description here"></a></p>

<p>My current code:</p>

<p>ListViewTracks GroupDescriptions:</p>

<pre><code> PropertyGroupDescription groupDescription = new PropertyGroupDescription("AlbumID");
 viewTrack.GroupDescriptions.Add(groupDescription);

 viewTrack.SortDescriptions.Add(new System.ComponentModel.SortDescription("AlbumTitle", System.ComponentModel.ListSortDirection.Ascending));
 viewTrack.SortDescriptions.Add(new System.ComponentModel.SortDescription("TitleTrack", System.ComponentModel.ListSortDirection.Ascending));
</code></pre>

<p>Employees data:</p>

<pre><code>     private ObservableCollection&lt;EmployeesAlbums&gt; _listAlbums = new ObservableCollection&lt;EmployeesAlbums&gt;();
     public ObservableCollection&lt;EmployeesTracks&gt; _listTrack = new ObservableCollection&lt;EmployeesTracks&gt;();


    public ObservableCollection&lt;EmployeesTracks&gt; PlayListTracks
    {
        get { return _listTrack; }
        set { _listTrack = value; RaisePropertyChanged("PlayListTracks"); }
    }
    public ObservableCollection&lt;EmployeesAlbums&gt; PlayListAlbums
    {
        get { return _listAlbums; }
        set { _listAlbums = value; RaisePropertyChanged("PlayListAlbums"); }
    }
    EmployeesAlbums model = new EmployeesAlbums
    {
       IdAlbums = int.Parse(rdr["Id"].ToString()),
       TitleAlbum = rdr["TitleAlbums"].ToString(),
       ArtistAlbum = rdr["ArtistAlbums"].ToString()
    };
    modelTracks = new EmployeesTracks
    {
       IdTrack = int.Parse(rdr["Id"].ToString()),
       TitleTrack = rdr["TitleTrack"].ToString(),
       PathTrack = rdr["Path"].ToString(),
       AlbumTitle = rdr["AlbumTitle"].ToString(),
       ArtistTrack = rdr["ArtistTrack"].ToString(),
       AlbumID = int.Parse(rdr["AlbumId"].ToString()).ToString()

    };
</code></pre>

<p>SelectedItem of ListViewAlbums:</p>

<pre><code>    SelectionChangedItemsAlbumCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(SelectionChangedItemsAlbum);       

    private EmployeesAlbums _selectedPlayListFileAlbum;       
    public EmployeesAlbums SelectedPlayListFileAlbum
    {
        get { return _selectedPlayListFileAlbum; }
        set
        {

            if (_selectedPlayListFileAlbum != value)
            {
                _selectedPlayListFileAlbum = value;
                RaisePropertyChanged("SelectedPlayListFileAlbum");
            }     
        }
    }

    private IEnumerable&lt;EmployeesAlbums&gt; _selectedPlayListFilesAlbums;
    public IEnumerable&lt;EmployeesAlbums&gt; SelectedPlayListFilesAlbums
    {
        get { return this.selectedPlayListFilesAlbums; }
        set { Set(ref selectedPlayListFilesAlbums, value); }
    }
</code></pre>

<p>Filtering:</p>

<pre><code>    public string AlbumID { get; set; }
    void SelectionChangedItemsAlbum()
    {

            foreach (var items in SelectedPlayListFilesAlbums)
            {

                ListCollectionView empView = CollectionViewSource.GetDefaultView(PlayListTracks) as ListCollectionView;
                // Enable Live Filtering of the ListViewCollection
                empView.IsLiveFiltering = true;
                // Enable the filtering on AlbumID
                empView.LiveFilteringProperties.Add("AlbumID");
                AlbumID = items.IdAlbums.ToString();
                // Filter based upon AlbumID
                empView.Filter = new Predicate&lt;object&gt;(IsMatchFoundAlbums);
                // Refresh Collection
                empView.Refresh();
            }
    }
    bool IsMatchFoundAlbums(object d)
    {
        bool res = false;
        EmployeesTracks emp = d as EmployeesTracks;
            if (emp.AlbumID == AlbumID)
            {
                res = true;
            }            
        return res;
    }
</code></pre>

<p>XAML Code:</p>

<pre><code>&lt;ListView x:Name="ListViewTracks" 

       VirtualizingPanel.ScrollUnit="Pixel"
       VirtualizingStackPanel.CacheLength="20,20"
       VirtualizingStackPanel.CacheLengthUnit="Item"

       ItemsSource="{Binding PlayListTracks}"  
       Style="{StaticResource CommonListViewStyleTracks}"      
       ItemContainerStyle="{DynamicResource styleListViewItem}"      
   &gt;

&lt;ListView.GroupStyle&gt;
            &lt;GroupStyle&gt;
                &lt;GroupStyle.Panel&gt;
                    &lt;ItemsPanelTemplate&gt;

                        &lt;VirtualizingStackPanel/&gt;

                    &lt;/ItemsPanelTemplate&gt;
                &lt;/GroupStyle.Panel&gt;
                &lt;GroupStyle.ContainerStyle&gt;
                    &lt;Style TargetType="{x:Type GroupItem}" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;
                        &lt;Setter Property="Control.Template"&gt;
                            &lt;Setter.Value&gt;
                                &lt;ControlTemplate TargetType="{x:Type GroupItem}"&gt;
                                    &lt;StackPanel&gt;
                                        &lt;ContentPresenter Content="{TemplateBinding ContentControl.Content}" 
                                        ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                        ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" /&gt;
                                        &lt;ItemsPresenter Margin="0,0,0,20" /&gt;
                                    &lt;/StackPanel&gt;
                                &lt;/ControlTemplate&gt;
                            &lt;/Setter.Value&gt;
                        &lt;/Setter&gt;
                    &lt;/Style&gt;
                &lt;/GroupStyle.ContainerStyle&gt;
                &lt;GroupStyle.HeaderTemplate&gt;
                    &lt;DataTemplate &gt;

                        &lt;Grid d:DesignWidth="460" Height="51"&gt;
                            &lt;StackPanel&gt;
                                &lt;TextBlock DataContext="{Binding Items}" Text="{Binding AlbumTitle}" FontSize="18" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource ItemsListViewForeground}"/&gt;
                                &lt;TextBlock DataContext="{Binding Items}" Text="{Binding ArtistTrack}" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource AccentColorApps}"/&gt;
                            &lt;/StackPanel&gt;
                        &lt;/Grid&gt;
                    &lt;/DataTemplate&gt;
                &lt;/GroupStyle.HeaderTemplate&gt;
            &lt;/GroupStyle&gt;
        &lt;/ListView.GroupStyle&gt;
        &lt;/ListView&gt;

        &lt;ListView 

              x:Name="ListViewAlbums" 
              VirtualizingPanel.IsVirtualizing="True" 
              VirtualizingPanel.VirtualizationMode="Recycling"
              IsSynchronizedWithCurrentItem="True"   
              ItemsSource="{Binding PlayListAlbums}"
              SelectionMode="Extended" 
              SelectedItem="{Binding SelectedPlayListFileAlbum,UpdateSourceTrigger=PropertyChanged}" SelectionMode="Extended" 
              behaviours:MultiSelectorBehaviours.SynchronizedSelectedItems="{Binding SelectedPlayListFilesAlbums, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 
              Background="{x:Null}" Grid.Column="1" Grid.RowSpan="4" 
              ItemTemplate="{DynamicResource AlbumsDataTemplate}"
              BorderBrush="{x:Null}"
              &gt;
         &lt;ie:Interaction.Triggers &gt;
            &lt;ie:EventTrigger EventName="SelectionChanged"&gt;
                &lt;ie:InvokeCommandAction Command="{Binding SelectionChangedItemsAlbumCommand}" 
                        CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}}"/&gt;
            &lt;/ie:EventTrigger&gt;
        &lt;/ie:Interaction.Triggers&gt;
        &lt;/ListView&gt;
</code></pre>

<p>Thanks a lot.  </p>