void Add() { var p = new Person(); var dlg = new PersonEditDialog { DataContext = p, Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (dlg.ShowDialog() == true) { People.Add(p); } }
public void Edit() { if (SelectedPerson == null) { return; } var p = SelectedPerson.Clone(); var dlg = new PersonEditDialog { DataContext = p, Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (dlg.ShowDialog() == true) { SelectedPerson.Copy(p); } }