From ff38cf7609b0f90fce9fff65e2bd7900edc84d22 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 19 Jun 2020 10:32:43 +0200 Subject: [PATCH] Fix non-virtualizing stack layout alignment. We need to return the max of the bounds and the constraint, otherwise horizontal/vertical alignment doesnt work correctly. --- src/Avalonia.Layout/NonVirtualizingStackLayout.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Layout/NonVirtualizingStackLayout.cs b/src/Avalonia.Layout/NonVirtualizingStackLayout.cs index 0b730315e1..6fa8601916 100644 --- a/src/Avalonia.Layout/NonVirtualizingStackLayout.cs +++ b/src/Avalonia.Layout/NonVirtualizingStackLayout.cs @@ -112,7 +112,9 @@ namespace Avalonia.Layout u = (isVertical ? bounds.Bottom : bounds.Right) + spacing; } - return new Size(bounds.Right, bounds.Bottom); + return new Size( + Math.Max(finalSize.Width, bounds.Width), + Math.Max(finalSize.Height, bounds.Height)); } private static Rect LayoutVertical(ILayoutable element, double y, Size constraint)