From f09683cf93791d9b676983a2e80d6852c63da987 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 24 Jul 2019 19:54:25 +0200 Subject: [PATCH] Hack around problem with Item 0 being shown... ...when switching to a scrolled UniformGridLayout. --- src/Avalonia.Layout/UniformGridLayoutState.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Avalonia.Layout/UniformGridLayoutState.cs b/src/Avalonia.Layout/UniformGridLayoutState.cs index e30c1a3c4b..4557a78d37 100644 --- a/src/Avalonia.Layout/UniformGridLayoutState.cs +++ b/src/Avalonia.Layout/UniformGridLayoutState.cs @@ -71,6 +71,13 @@ namespace Avalonia.Layout } _cachedFirstElement.Measure(availableSize); + + // This doesn't need to be done in the UWP version and I'm not sure why. If we + // don't do this here, and we receive a recycled element then it will be shown + // at its previous arrange point, but we don't want it shown at all until its + // arranged. + _cachedFirstElement.Arrange(new Rect(-10000.0, -10000.0, 0, 0)); + SetSize(_cachedFirstElement, layoutItemWidth, LayoutItemHeight, availableSize, stretch, orientation, minRowSpacing, minColumnSpacing); // See if we can move ownership to the flow algorithm. If we can, we do not need a local cache.