Skip to content

Commit 4da8129

Browse files
AndrewKeepCodingArlodotexe
authored andcommitted
Enhance WrapPanel row wrapping logic
Added an additional condition to the `WrapPanel` class to improve layout behavior. The new logic checks if `position.U` is greater than or equal to `parentMeasure.U`, ensuring the panel wraps to the next row when necessary. This change helps maintain proper alignment and spacing within the panel.
1 parent 8ca1ce9 commit 4da8129

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/Primitives/src/WrapPanel/WrapPanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void Arrange(UIElement child, bool isLast = false)
214214
}
215215

216216
var desiredMeasure = new UvMeasure(Orientation, child.DesiredSize);
217-
if ((desiredMeasure.U + position.U + paddingEnd.U) > parentMeasure.U)
217+
if ((desiredMeasure.U + position.U + paddingEnd.U) > parentMeasure.U || position.U >= parentMeasure.U)
218218
{
219219
// next row!
220220
position.U = paddingStart.U;

0 commit comments

Comments
 (0)