private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DataGrid dg = sender as DataGrid; if (dg == null) { return; } Zinsfestschreibung zinsF = (Zinsfestschreibung)dg.SelectedItem; if (zinsF == null) { return; } var viewModel = new EigenschaftenZinsfestschreibungViewModel(zinsF); var window = new EigenschaftenZinsfestschreibungView(); window.Owner = this; window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; EventHandler handler = null; handler = delegate { viewModel.RequestClose -= handler; window.Close(); }; viewModel.RequestClose += handler; window.DataContext = viewModel; window.ShowDialog(); }
private void NeuZinszeitraum() { Zinsfestschreibung zinsfest = new Zinsfestschreibung(); var viewModel = new EigenschaftenZinsfestschreibungViewModel(zinsfest); var window = new EigenschaftenZinsfestschreibungView(); window.Owner = App.window; window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; EventHandler handler = null; handler = delegate { viewModel.RequestClose -= handler; window.Close(); }; viewModel.RequestClose += handler; window.DataContext = viewModel; window.ShowDialog(); if (viewModel.DialogResult == true) { kredit.Zinszeitraeume.Add(zinsfest); } }