Browse Source

[14735]: MessageBox: fixed ArgulmentNullException when showing a messageBox before a window has loaded.

pull/1645/head
brianlagunas_cp 16 years ago
parent
commit
606aeda9f9
  1. 27
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/MessageBox.cs

27
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/MessageBox.cs

@ -345,18 +345,21 @@ namespace Microsoft.Windows.Controls
/// <returns></returns> /// <returns></returns>
private Window CreateContainer() private Window CreateContainer()
{ {
return new Window() var newWindow = new Window();
{ newWindow.AllowsTransparency = true;
AllowsTransparency = true, newWindow.Background = Brushes.Transparent;
Background = Brushes.Transparent, newWindow.Content = this;
Content = this,
Owner = Window.GetWindow(ResolveOwner()), var owner = ResolveOwner();
ShowInTaskbar = false, if (owner != null)
SizeToContent = System.Windows.SizeToContent.WidthAndHeight, newWindow.Owner = Window.GetWindow(owner);
ResizeMode = System.Windows.ResizeMode.NoResize,
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner, newWindow.ShowInTaskbar = false;
WindowStyle = System.Windows.WindowStyle.None 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;
} }
#endregion //Private #endregion //Private

Loading…
Cancel
Save