private void DeletePlaylist(object sender, RoutedEventArgs e) { Button button = sender as Button; MainPageData dataContext = button.DataContext as MainPageData; var selectedItem = PlaylistListView.SelectedItem; if (selectedItem != null) { PlaylistModel playlist = dataContext.GetPlaylist(selectedItem.ToString()); if (playlist != null) { dataContext.RemovePlayList(playlist); } } }
private void SetActivePlaylist(object sender, SelectionChangedEventArgs e) { ListView listView = sender as ListView; MainPageData dataContext = listView.DataContext as MainPageData; PlaylistModel selectedItem = listView.SelectedItem as PlaylistModel; if (selectedItem != null) { PlaylistModel playlist = dataContext.GetPlaylist(selectedItem.Name.ToString()); if (playlist != null) { dataContext.ChangePlaylist(playlist); } } }