private async void Window_Loaded(object sender, RoutedEventArgs e) { songListView.DataContext = this.list; songListView.Items.SortDescriptions.Add(new SortDescription("Title", ListSortDirection.Ascending)); filter = new SongFilter(); filter.PropertyChanged += (s, a) => { ICollectionView view = CollectionViewSource.GetDefaultView(songListView.ItemsSource); view.Filter = filter.IsEmpty ? null : new Predicate <object>(FilterCallback); songListView.SelectedIndex = 0; }; filterGroupBox.DataContext = filter; await LoadSongsAsync(); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { songListView.DataContext = this.list; songListView.Items.SortDescriptions.Add(new SortDescription("Title", ListSortDirection.Ascending)); filter = new SongFilter(); filter.PropertyChanged += (s, a) => { ICollectionView view = CollectionViewSource.GetDefaultView(songListView.ItemsSource); view.Filter = filter.IsEmpty ? null : new Predicate<object>(FilterCallback); songListView.SelectedIndex = 0; }; filterGroupBox.DataContext = filter; await LoadSongsAsync(); }