From be53443c62958708d4b5a7d0e1f9c9eb6507a88d Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Tue, 8 Mar 2011 19:57:27 +0000 Subject: [PATCH] MessageBox: fix issue when showing a MessageBox without an owner, the control should open center screen, not center owner. --- .../MessageBox/Implementation/MessageBox.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs index 1ef568e2..729325ca 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/Implementation/MessageBox.cs @@ -352,12 +352,16 @@ namespace Microsoft.Windows.Controls var owner = ResolveOwner(); if (owner != null) + { newWindow.Owner = Window.GetWindow(owner); + newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; + } + else + newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; newWindow.ShowInTaskbar = false; newWindow.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; newWindow.ResizeMode = System.Windows.ResizeMode.NoResize; - newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; newWindow.WindowStyle = System.Windows.WindowStyle.None; return newWindow; }