//public DialogService(IContainerViewModel containerVm) //{ // _containerVm = containerVm ?? throw new ArgumentNullException(nameof(containerVm)); //} public void ShowDialog(IDialogViewModel viewModel, bool resizeable, string style) { var window = new Window { Content = viewModel, Title = viewModel.Title ?? string.Empty, Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner, ShowInTaskbar = false, ResizeMode = resizeable ? ResizeMode.CanResize : ResizeMode.NoResize, }; window.Style = (Style)window.FindResource(style); viewModel.CloseDialogRequested += (s, args) => { window.Close(); }; window.Closing += (s, arg) => { viewModel.OnClosing(s, arg); }; window.Loaded += (s, arg) => { viewModel.OnLoaded(s, arg); }; window.ShowDialog(); }