From 6333276c1b193ba9966ad5de57aeddfc90ff1c00 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Tue, 5 Mar 2024 15:08:47 +0800 Subject: [PATCH] fix: #1533 --- src/Shared/HandyControl_Shared/Controls/Panel/Grid/Row.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/Grid/Row.cs b/src/Shared/HandyControl_Shared/Controls/Panel/Grid/Row.cs index 239b95d1..3b4bd3ce 100644 --- a/src/Shared/HandyControl_Shared/Controls/Panel/Grid/Row.cs +++ b/src/Shared/HandyControl_Shared/Controls/Panel/Grid/Row.cs @@ -59,7 +59,9 @@ public class Row : Panel if (cellCount > 0 && !child.IsFixed) { totalCellCount += cellCount; - child.Measure(new Size(cellCount * itemWidth - gutter, constraint.Height)); + var availableWidth = Math.Max(0, cellCount * itemWidth - gutter); + + child.Measure(new Size(availableWidth, constraint.Height)); _maxChildDesiredHeight = Math.Max(_maxChildDesiredHeight, child.DesiredSize.Height); if (totalCellCount > ColLayout.ColMaxCellCount) @@ -94,7 +96,7 @@ public class Row : Panel var cellCount = child.GetLayoutCellCount(_layoutStatus); totalCellCount += cellCount; - var childWidth = (cellCount > 0 && !child.IsFixed) ? cellCount * itemWidth - gutter : child.DesiredSize.Width; + var childWidth = (cellCount > 0 && !child.IsFixed) ? Math.Max(0, cellCount * itemWidth - gutter) : child.DesiredSize.Width; childBounds.Width = childWidth; childBounds.X += child.Offset * itemWidth;