private void editDepartment_MouseUp(object sender, MouseButtonEventArgs e) { DataRowView row = (DataRowView)departmentsGrid.SelectedItem; if (row != null) { int id = (int)row["ID"]; string name = (string)row["Name"]; string faculty = (string)row["Faculty"]; DepartmentAddEdit addEdit = new DepartmentAddEdit(); addEdit.Closed += (s, eventarg) => { departments_Initialized(s, eventarg); }; addEdit.Owner = this; addEdit.txtId.Text = id.ToString(); addEdit.txtName.Text = name; addEdit.comboBox.Text = faculty; addEdit.ShowDialog(); } else { MessageBox.Show("Please select a row to edit!", "Information", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void addDepartment_MouseUp(object sender, MouseButtonEventArgs e) { DepartmentAddEdit addEdit = new DepartmentAddEdit(); addEdit.Closed += (s, eventarg) => { departments_Initialized(s, eventarg); }; addEdit.Owner = this; addEdit.ShowDialog(); }