private static Window CreateModalExternalWindow(MetroWindow window) { var win = CreateExternalWindow(); win.Owner = window; win.Topmost = false; // It is not necessary here because the owner is setted win.WindowStartupLocation = WindowStartupLocation.CenterOwner; // WindowStartupLocation should be CenterOwner // Set Width and Height maximum according Owner if (window.WindowState != WindowState.Maximized) { win.Width = window.ActualWidth; win.MaxHeight = window.ActualHeight; } else { // Remove the border on left and right side win.BeginInvoke(x => { x.SetCurrentValue(Control.BorderThicknessProperty, new Thickness(0, x.BorderThickness.Top, 0, x.BorderThickness.Bottom)); if (x is MetroWindow metroWindow) { metroWindow.SetCurrentValue(MetroWindow.ResizeBorderThicknessProperty, new Thickness(0, metroWindow.ResizeBorderThickness.Top, 0, metroWindow.ResizeBorderThickness.Bottom)); } }, DispatcherPriority.Loaded); // Get the monitor working area var monitorWorkingArea = window.GetMonitorWorkSize(); if (monitorWorkingArea != default) { win.Width = monitorWorkingArea.Width; win.MaxHeight = monitorWorkingArea.Height; } else { win.Width = window.ActualWidth; win.MaxHeight = window.ActualHeight; } } win.SizeToContent = SizeToContent.Height; return(win); }