private async void LoadFilters() { var resourceLoader = ResourceLoader.GetForViewIndependentUse(); var songs = await library.GetSongsForGenre(genre); var filters = new FilterViewModel[]{ new AllSongsFilter(resourceLoader, s => songs.Any(p => p.Id == s.Id), SongSource.GenreSource(genre.Id)) }; foreach (var filter in filters) filter.LoadData(library); this.Filters = filters; }
private FilterPivotItem CreatePivotItem(FilterViewModel filterViewModel) { FilterPivotItem result = null; if (filterViewModel.GetType() == typeof(SearchFilter)) result = new SearchItem() { DataContext = filterViewModel }; else result = new GenericItem() { DataContext = filterViewModel }; result.Header = filterViewModel.Header; result.SetBinding(FilterPivotItem.NavigationFrameProperty, new Binding() { Source = this, Path = new PropertyPath("NavigationFrame") }); result.SetBinding(FilterPivotItem.CanChangeSelectedProperty, new Binding() { Source = this, Path = new PropertyPath("CanChangeSelected") }); result.SetBinding(FilterPivotItem.GoBackAfterClickProperty, new Binding() { Source = this, Path = new PropertyPath("GoBackAfterClick") }); if (result == null) throw new NotImplementedException(); else return result; }