Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ public override Size ArrangeChildren(Rect rectangle)
var width = rectangle.Width - uniformItemsLayout.Padding.HorizontalThickness;
var visibleChildren = uniformItemsLayout.Where(x => x.Visibility == Visibility.Visible).ToArray();

if (visibleChildren.Length == 0 || width == 0)
{
return rectangle.Size;
}

var columns = GetColumnsCount(visibleChildren.Length, width);
var rows = GetRowsCount(visibleChildren.Length, columns);

var boundsWidth = columns == 0 ? 0 : width / columns;
var boundsWidth = width / columns;
Comment thread
TheCodeTraveler marked this conversation as resolved.
var boundsHeight = childHeight;
var bounds = new Rect(0, 0, boundsWidth, boundsHeight);
var count = 0;
Expand All @@ -51,7 +56,7 @@ public override Size ArrangeChildren(Rect rectangle)
}
}

return bounds.Size;
return rectangle.Size;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ public void MaxRowsArrangeChildrenUniformItemsLayout()
[Fact]
public void ArrangeChildrenUniformItemsLayout()
{
var expectedSize = new Size(childWidth, childHeight);
uniformChild = new TestView(expectedSize);
var childSize = new Size(childWidth, childHeight);
uniformChild = new TestView(childSize);
uniformItemsLayout.CrossPlatformMeasure(double.PositiveInfinity, double.PositiveInfinity);
var rect = new Rect(0, 0, childWidth * childCount, childHeight * childCount);
uniformItemsLayout.Layout(rect);
var actualSize = uniformItemsLayout.CrossPlatformArrange(rect);

Assert.Equal(expectedSize, actualSize);
Assert.Equal(childSize * childCount, actualSize);
}

class TestView : View
Expand Down