Skip to content

Commit e02211f

Browse files
CopilotSuthiYuvaraj
andcommitted
Fix UICollectionViewFlowLayout spacing configuration to prevent horizontal layout in vertical mode
Co-authored-by: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com>
1 parent fbe056e commit e02211f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,14 +526,10 @@ public MeasureFirstItemCollectionViewLayout(LayoutSnapInfo snapInfo, UICollectio
526526
_headerFooterInfo = headerFooterInfo;
527527
ScrollDirection = scrollDirection;
528528

529-
if (scrollDirection == UICollectionViewScrollDirection.Vertical)
530-
{
531-
MinimumLineSpacing = (nfloat)itemSpacing;
532-
}
533-
else
534-
{
535-
MinimumInteritemSpacing = (nfloat)itemSpacing;
536-
}
529+
// For both vertical and horizontal layouts, MinimumLineSpacing controls the main axis spacing
530+
// This follows the pattern used in other MAUI layouts
531+
MinimumLineSpacing = (nfloat)itemSpacing;
532+
MinimumInteritemSpacing = 0; // Cross-axis spacing set to 0 for single item per line behavior
537533

538534
// Start with estimated size, will be updated after measuring first item
539535
EstimatedItemSize = new CGSize(100, 44);

0 commit comments

Comments
 (0)