private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (MainListBox.SelectedIndex == -1) { return; } VsbSongbook myresults = MainListBox.SelectedItem as VsbSongbook; settings.CurrSongSetting = myresults.SongID - 1; NavigationService.Navigate(new Uri("/SongView.xaml", UriKind.Relative)); MainListBox.SelectedIndex = -1; }
private void LoadSongBookItems() { XDocument XmlDyta = XDocument.Load("RealData/vSongBook.xml"); var songitems = from query in XmlDyta.Descendants("ItemViewSong") select new SongItem() { SongTitle = query.Attribute("SongTitle").Value, SongContent = query.Attribute("SongContent").Value, SongIcon = query.Attribute("SongIcon").Value }; foreach (var song in songitems) { VsbSongbook SongAdd = new VsbSongbook { SongTitle = song.SongTitle, SongContent = song.SongContent, SongIcon = song.SongIcon }; App.viewSongBook.AddVsbSongbook(SongAdd); } }