コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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();
            }
        }