From e58a0641bf842eab3777d2bae7b5cfb8f4d28d09 Mon Sep 17 00:00:00 2001 From: walterlv Date: Sun, 6 May 2018 07:57:00 +0800 Subject: [PATCH] If the children are in the same column/row, the Grid will not incorrectly aggregate their widths/heights. Instead, it will calculate the Max width/height. --- src/Avalonia.Controls/Utils/GridLayout.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Utils/GridLayout.cs b/src/Avalonia.Controls/Utils/GridLayout.cs index dd260f31df..53ca7b13c5 100644 --- a/src/Avalonia.Controls/Utils/GridLayout.cs +++ b/src/Avalonia.Controls/Utils/GridLayout.cs @@ -378,9 +378,10 @@ namespace Avalonia.Controls.Utils // 需要返回所有标记为 * 的方格的累加和的最小值。 // Before we determine the behavior of this method, we just aggregate the one-span * columns. - return _additionalConventions + var lookup = _additionalConventions .Where(x => x.Span == 1 && conventions[x.Index].Length.IsStar) - .Sum(x => x.Min); + .ToLookup(x => x.Index); + return lookup.Select(group => group.Max(x => x.Min)).Sum(); } ///