private void btnEdit_Click(object sender, RoutedEventArgs e) { Person currentPerson = (Person)lbxPersons.SelectedItem; PersonEditDlg dlg = new PersonEditDlg { Owner = this, Person = currentPerson }; if (dlg.ShowDialog() == true) { currentPerson.CopyFrom(dlg.Person); } }