Răsfoiți Sursa

Invalidate parent measure when child visibility changes.

Fixes #7552 but breaks `ListBoxTests.LayoutManager_Should_Measure_Arrange_All`.
Steven Kirk 3 ani în urmă
părinte
comite
1f3cb4fa00
1 a modificat fișierele cu 11 adăugiri și 1 ștergeri
  1. 11 1
      src/Avalonia.Layout/Layoutable.cs

+ 11 - 1
src/Avalonia.Layout/Layoutable.cs

@@ -141,7 +141,6 @@ namespace Avalonia.Layout
         static Layoutable()
         {
             AffectsMeasure<Layoutable>(
-                IsVisibleProperty,
                 WidthProperty,
                 HeightProperty,
                 MinWidthProperty,
@@ -781,6 +780,17 @@ namespace Avalonia.Layout
         {
         }
 
+        protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
+        {
+            base.OnPropertyChanged(change);
+
+            if (change.Property == IsVisibleProperty)
+            {
+                DesiredSize = default;
+                this.GetVisualParent<ILayoutable>()?.ChildDesiredSizeChanged(this);
+            }
+        }
+
         /// <inheritdoc/>
         protected sealed override void OnVisualParentChanged(IVisual? oldParent, IVisual? newParent)
         {