private void GenreComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (GenreComboBox.SelectedIndex == -1) { return; } Genre selectedGenre = (Genre)GenreComboBox.SelectedItem; albumDataGrid.ItemsSource = AlbumSummaryService.GetAlbumSummariesByGenre(selectedGenre.ID); }
private void genreComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Genre genre = genreComboBox.SelectedItem as Genre; IList <AlbumSummary> sum = new List <AlbumSummary>(); sum = AlbumSummaryService.GetAlbumSummariesByGenre(genre.GenreId); albumDataGrid.Items.Clear(); foreach (AlbumSummary albumSummary in sum) { albumDataGrid.Items.Add(albumSummary); } }
private void genreComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { albumDataGrid.DataContext = null; int index = 0; List <AlbumSummary> albumsInAanmerking = new List <AlbumSummary>(); for (int i = 0; i < alleGenresGlobaal.Count; i++) { if ((int)genreComboBox.SelectedValue - 1 == i) { index = i; i = alleGenresGlobaal.Count; } } albumsInAanmerking = AlbumSummaryService.GetAlbumSummariesByGenre(alleGenresGlobaal[index]); albumDataGrid.DataContext = albumsInAanmerking; }