private void addButton_Click(object sender, RoutedEventArgs e) { // добавим новую строку DataRow newRow = dt.NewRow(); EditWindow editWindow = new EditWindow(newRow); editWindow.ShowDialog(); if (editWindow.DialogResult.HasValue && editWindow.DialogResult.Value) { dt.Rows.Add(editWindow.resultRow); adapter.Update(dt); } }
private void updateButton_Click(object sender, RoutedEventArgs e) { DataRowView newRow = (DataRowView)peopleDataGrid.SelectedItem; newRow.BeginEdit(); EditWindow editWindow = new EditWindow(newRow.Row); editWindow.ShowDialog(); if (editWindow.DialogResult.HasValue && editWindow.DialogResult.Value) { newRow.EndEdit(); adapter.Update(dt); } else { newRow.CancelEdit(); } }