From ddf266d9ae6bb9220e7b53a2ec63215f2c8b62a8 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 18 May 2022 13:20:08 +0200 Subject: [PATCH] Invalidate measure when showing a control. But not when hiding it. --- src/Avalonia.Base/Layout/Layoutable.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Avalonia.Base/Layout/Layoutable.cs b/src/Avalonia.Base/Layout/Layoutable.cs index f425c04a71..f30925f489 100644 --- a/src/Avalonia.Base/Layout/Layoutable.cs +++ b/src/Avalonia.Base/Layout/Layoutable.cs @@ -797,7 +797,15 @@ namespace Avalonia.Layout if (change.Property == IsVisibleProperty) { DesiredSize = default; + + // All changes to visibility cause the parent element to be notified. this.GetVisualParent()?.ChildDesiredSizeChanged(this); + + // We only invalidate outselves when visibility is changed to true. + if (change.GetNewValue()) + { + InvalidateMeasure(); + } } }