Bläddra i källkod

Quick and dirty hack to fix #1054

This fixes the problem decribed in #1054 but I think there's something wrong with the way we handle top level layout anyway and it's going to need refactoring soon.

(cherry picked from commit 7337a90fc1eb92467c8f3052b6108dbad57d1d1b)
Steven Kirk 8 år sedan
förälder
incheckning
33fd46c789
1 ändrade filer med 8 tillägg och 1 borttagningar
  1. 8 1
      src/Avalonia.Controls/WindowBase.cs

+ 8 - 1
src/Avalonia.Controls/WindowBase.cs

@@ -29,6 +29,7 @@ namespace Avalonia.Controls
         public static readonly DirectProperty<WindowBase, bool> IsActiveProperty =
             AvaloniaProperty.RegisterDirect<WindowBase, bool>(nameof(IsActive), o => o.IsActive);
 
+        private bool _hasExecutedInitialLayoutPass;
         private bool _isActive;
         private bool _ignoreVisibilityChange;
 
@@ -136,7 +137,13 @@ namespace Avalonia.Controls
             {
                 EnsureInitialized();
                 IsVisible = true;
-                LayoutManager.Instance.ExecuteInitialLayoutPass(this);
+
+                if (!_hasExecutedInitialLayoutPass)
+                {
+                    LayoutManager.Instance.ExecuteInitialLayoutPass(this);
+                    _hasExecutedInitialLayoutPass = true;
+                }
+
                 PlatformImpl?.Show();
             }
             finally