From f3a38a329ec6a1e203823b5b24d4ceb6ebb60806 Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Tue, 3 Mar 2015 22:13:24 +0100 Subject: [PATCH] Fix: FormLocationHelper has set wrong window location when opening a dialog from another dialog. --- src/Main/Base/Project/Src/Gui/FormLocationHelper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Main/Base/Project/Src/Gui/FormLocationHelper.cs b/src/Main/Base/Project/Src/Gui/FormLocationHelper.cs index 1f2e5e5f30..6e85c9668f 100644 --- a/src/Main/Base/Project/Src/Gui/FormLocationHelper.cs +++ b/src/Main/Base/Project/Src/Gui/FormLocationHelper.cs @@ -53,11 +53,11 @@ namespace ICSharpCode.SharpDevelop.Gui public static void ApplyWindow(Window window, string propertyName, bool isResizable) { window.WindowStartupLocation = WindowStartupLocation.Manual; - var ownerLocation = GetOwnerLocation(window); if (isResizable) { - Rect bounds = PropertyService.Get(propertyName, GetDefaultBounds(window)); - bounds.Offset(ownerLocation.X, ownerLocation.Y); window.SourceInitialized += delegate { + var ownerLocation = GetOwnerLocation(window); + Rect bounds = PropertyService.Get(propertyName, GetDefaultBounds(window)); + bounds.Offset(ownerLocation.X, ownerLocation.Y); bounds = Validate(bounds.TransformToDevice(window).ToSystemDrawing()) .ToWpf().TransformFromDevice(window); window.Left = bounds.X; @@ -67,6 +67,7 @@ namespace ICSharpCode.SharpDevelop.Gui }; } else { window.SourceInitialized += delegate { + var ownerLocation = GetOwnerLocation(window); Size size = new Size(window.ActualWidth, window.ActualHeight); Point location = PropertyService.Get(propertyName, GetDefaultLocation(window)); location.Offset(ownerLocation.X, ownerLocation.Y);