private async void MenuAddPlaylist_Click(object sender, RoutedEventArgs e) { var parent = VisualTreeHelper.GetParent(this); while (!(parent is UserControl)) { parent = VisualTreeHelper.GetParent(parent); } //var test = (parent as UserControl).GetValue(); ContentDialog1 ct = new ContentDialog1(); var result = await ct.ShowAsync(); //if create button on dialog box is created then textbox content will go in text if (result == ContentDialogResult.Primary) { var text = ct.Text; } // if cancel button is clicked then textbox text will become null and dialog box window will be hidden else { ct.Text = " "; ct.Hide(); } p = ct.Text; // to add playlist with the name typed in textbox in list of playlists if (p != " ") { PlayList UP = new PlayList(p); DataSource.AddPlayList(UP); } }
private async void AddPlaylistButton_Click(object sender, RoutedEventArgs e) { ContentDialog1 ct = new ContentDialog1(); var result = await ct.ShowAsync(); //if create button on dialog box is created then textbox content will go in text if (result == ContentDialogResult.Primary) { var text = ct.Text; // ListBox1.DataContext = text; // ListBox1.Items.Add(text); } // if cancel button is clicked then textbox text will become null and dialog box window will be hidden else { ct.Text = " "; //ct.Hide(); } p = ct.Text; // to add playlist with the name typed in textbox in list of playlists if (p != " ") { PlayList UP = new PlayList(p); DataSource.AddPlayList(UP); DataSource.getAllPlayLists(ref playlists); } }