private bool? ShowDialog(DialogWindow window) { window.Owner = GetCurrentTopWindow(); try { _currentDialogs.Push(window); return window.ShowDialog(); } finally { _currentDialogs.Pop(); } }
public bool? ShowDialogForViewModel(DialogViewModel viewModel) { var view = _viewLocator.CreateViewForViewModel(viewModel); view.DataContext = viewModel; var window = new DialogWindow() { Content = view, WindowStartupLocation = WindowStartupLocation.CenterOwner, }; window.SetBinding(Window.TitleProperty, new Binding("Title") {Source = viewModel}); viewModel.Closed += delegate { window.DialogResult = viewModel.DialogResult; window.Close(); }; return ShowDialog(window); }