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 @@ protected override Size MeasureOverride(Size constraint) 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 @@ protected override Size ArrangeOverride(Size finalSize) 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;