private void Btn_Neu_Click(object sender, RoutedEventArgs e) { PersonenDialog dialog = new PersonenDialog(); if (dialog.ShowDialog() == true) { Personenliste.Add(dialog.DataContext as Person); } }
private void Btn_Aendern_Click(object sender, RoutedEventArgs e) { PersonenDialog dialog = new PersonenDialog(); dialog.DataContext = new Person(Dgd_Personen.SelectedItem as Person); dialog.Title = (dialog.DataContext as Person).Vorname + " " + (dialog.DataContext as Person).Nachname; if (dialog.ShowDialog() == true) Personenliste[Dgd_Personen.SelectedIndex] = (dialog.DataContext as Person); }