private void EditStaffel(object sender, RoutedEventArgs e) { try { Staffel Current = (Staffel)cbStaffeln.SelectedItem; StaffelEdit Edit = new StaffelEdit((Staffel)Current.Clone()); if ((bool)Edit.ShowDialog()) { int Selected = this.cbStaffeln.SelectedIndex; ((ObservableCollection <Staffel>) this.cbStaffeln.ItemsSource).Replace(Current, (Staffel)Edit.Return); this.cbStaffeln.SelectedIndex = Selected; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Staffel bearbeiten nicht möglich."); } }
private void EditStaffel(object sender, RoutedEventArgs e) { try { Staffel Current = (Staffel)cbStaffeln.SelectedItem; StaffelEdit Edit = new StaffelEdit((Staffel)Current.Clone()); if ((bool)Edit.ShowDialog()) { int Selected = this.cbStaffeln.SelectedIndex; ((ObservableCollection<Staffel>)this.cbStaffeln.ItemsSource).Replace(Current, (Staffel)Edit.Return); this.cbStaffeln.SelectedIndex = Selected; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Staffel bearbeiten nicht möglich."); } }