diff --git a/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs b/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs index 83e357b87faa..81043f37416d 100644 --- a/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs @@ -45,7 +45,6 @@ protected override UICollectionViewLayout SelectLayout() NSCollectionLayoutDimension itemHeight = NSCollectionLayoutDimension.CreateFractionalHeight(1); NSCollectionLayoutDimension groupWidth = NSCollectionLayoutDimension.CreateFractionalWidth(1); NSCollectionLayoutDimension groupHeight = NSCollectionLayoutDimension.CreateFractionalHeight(1); - nfloat itemSpacing = 0; NSCollectionLayoutGroup group = null; var layout = new UICollectionViewCompositionalLayout((sectionIndex, environment) => @@ -92,8 +91,11 @@ protected override UICollectionViewLayout SelectLayout() // Create our section layout var section = NSCollectionLayoutSection.Create(group: group); - section.InterGroupSpacing = itemSpacing; section.OrthogonalScrollingBehavior = IsHorizontal ? UICollectionLayoutSectionOrthogonalScrollingBehavior.GroupPagingCentered : UICollectionLayoutSectionOrthogonalScrollingBehavior.None; + if (VirtualView.ItemsLayout is LinearItemsLayout linearItemsLayout) + { + section.InterGroupSpacing = (nfloat)linearItemsLayout.ItemSpacing; + } section.VisibleItemsInvalidationHandler = (items, offset, env) => { //This will allow us to SetPosition when we are scrolling the items diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml index 566b38dc8d72..b3a386c65a7f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml @@ -1,28 +1,29 @@  - - + + Item1 Item2 Item3 - - + + - - + + - - + + \ No newline at end of file