Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Remove unnecessary edge inset for vertically scrolling groups; Fixes … #13380

Merged
merged 2 commits into from
Feb 9, 2021
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 @@ -9,7 +9,7 @@
<CollectionView x:Name="CollectionView" IsGrouped="True" Header="This is a header" Footer="This is a footer.">

<CollectionView.ItemsLayout>
<GridItemsLayout Span="2" Orientation="Vertical"></GridItemsLayout>
<GridItemsLayout Span="2" HorizontalItemSpacing="5" Orientation="Vertical"></GridItemsLayout>
</CollectionView.ItemsLayout>

<CollectionView.ItemTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,34 +217,24 @@ int GetLayoutSpanCount()
return uIEdgeInsets;
}

// If we're grouping, we'll need to inset the sections to maintain the item spacing between the
// groups and/or their group headers/footers
// If we're grouping, we'll need to inset the sections to maintain the spacing between the
// groups and their group headers/footers

var itemsLayout = ItemsView.ItemsLayout;
var scrollDirection = itemsViewLayout.ScrollDirection;
nfloat lineSpacing = itemsViewLayout.GetMinimumLineSpacingForSection(collectionView, itemsViewLayout, section);
nfloat spacing = itemsViewLayout.GetMinimumLineSpacingForSection(collectionView, itemsViewLayout, section);
mattleibow marked this conversation as resolved.
Show resolved Hide resolved

if (itemsLayout is GridItemsLayout)
{
nfloat itemSpacing = itemsViewLayout.GetMinimumInteritemSpacingForSection(collectionView, itemsViewLayout, section);

if (scrollDirection == UICollectionViewScrollDirection.Horizontal)
{
return new UIEdgeInsets(itemSpacing + uIEdgeInsets.Top, lineSpacing + uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
}
var top = uIEdgeInsets.Top;
var left = uIEdgeInsets.Left;

return new UIEdgeInsets(lineSpacing + uIEdgeInsets.Top, itemSpacing + uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
if (itemsViewLayout.ScrollDirection == UICollectionViewScrollDirection.Horizontal)
{
left += spacing;
}

if (scrollDirection == UICollectionViewScrollDirection.Horizontal)
else
{
return new UIEdgeInsets(uIEdgeInsets.Top, lineSpacing + uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
top += spacing;
}

return new UIEdgeInsets(lineSpacing + uIEdgeInsets.Top, uIEdgeInsets.Left,
return new UIEdgeInsets(top, left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
}

Expand Down