private async void cbbEdit_Click(object sender, RoutedEventArgs e) { var item = originalSource.DataContext as Category; DataTable dt = QueryForSQLServer.GetCategoryByName(item.Name); int id = (int)dt.Rows[0].ItemArray[0]; TextBox input = new TextBox() { Height = (double)App.Current.Resources["TextControlThemeMinHeight"], PlaceholderText = "Display Text" }; ContentDialog dialog = new ContentDialog() { Title = "Change Category's Name", MaxWidth = this.ActualWidth, PrimaryButtonText = "OK", SecondaryButtonText = "Cancel", Content = input }; ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { input = (TextBox)dialog.Content; if (input.Text != "") { var cat = new Category() { Id = item.Id, Name = input.Text }; QueryForSQLServer.UpdateCategory(cat); await new Windows.UI.Popups.MessageDialog("Updated!").ShowAsync(); Refresh(); } else { await new Windows.UI.Popups.MessageDialog("Nothing Change!").ShowAsync(); } } }