Browse Source

MessageBox: fix issue when showing a MessageBox without an owner, the control should open center screen, not center owner.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
be53443c62
  1. 6
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs

6
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs

@ -352,12 +352,16 @@ namespace Microsoft.Windows.Controls
var owner = ResolveOwner(); var owner = ResolveOwner();
if (owner != null) if (owner != null)
{
newWindow.Owner = Window.GetWindow(owner); newWindow.Owner = Window.GetWindow(owner);
newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
}
else
newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
newWindow.ShowInTaskbar = false; newWindow.ShowInTaskbar = false;
newWindow.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; newWindow.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
newWindow.ResizeMode = System.Windows.ResizeMode.NoResize; newWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
newWindow.WindowStyle = System.Windows.WindowStyle.None; newWindow.WindowStyle = System.Windows.WindowStyle.None;
return newWindow; return newWindow;
} }

Loading…
Cancel
Save