private void Genre_SelectionChanged(object sender, SelectionChangedEventArgs e) { var Query = from en in aud.Elements("Entry") where en.Element("Genre").Value == (sender as ListBox).SelectedItem.ToString() select en; Musique.DataContext = Query; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<ListBox Height="22" HorizontalAlignment="Left" Margin="626,43,0,0" Name="Genre" VerticalAlignment="Top" Width="75" SelectionChanged="Genre_SelectionChanged" ItemsSource="{Binding}"> <ListBoxItem>Rock</ListBoxItem> <ListBoxItem>Metal</ListBoxItem> <ListBoxItem>Classique</ListBoxItem> <ListBoxItem>Autre</ListBoxItem> </ListBox>
private void Genre_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBoxItem test = ((sender as ListBox).SelectedItem as ListBoxItem); var Query = from en in aud.Elements("Entry") where en.Element("Genre").Value == test.Content.ToString() select en; Musique.DataContext = Query; }