Skip to content

Commit 4fcaf52

Browse files
SuthiYuvarajrmarinho
authored andcommitted
Fix -[iOS] - CarouselView Throws ArgumentOutOfRangeException Immediately on Application Launch in CV2 (#29316)
* Update ItemsSourceFactory2.cs * Update CarouselViewPositionVisibility.xaml
1 parent 06bbf70 commit 4fcaf52

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static ILoopItemsViewSource CreateForCarouselView(IEnumerable itemsSource
2222
IList _ when itemsSource is INotifyCollectionChanged => new LoopObservableItemsSource2(itemsSource as IList, collectionViewController, loop),
2323
IEnumerable _ when itemsSource is INotifyCollectionChanged => new LoopObservableItemsSource2(itemsSource as IEnumerable, collectionViewController, loop),
2424
IEnumerable<object> generic => new LoopListSource2(generic, loop),
25-
_ => new LoopListSource(itemsSource, loop),
25+
_ => new LoopListSource2(itemsSource, loop),
2626
};
2727
}
2828

src/Controls/tests/TestCases.HostApp/Issues/CarouselViewPositionVisibility.xaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@
1111
BackgroundColor="Black"
1212
TextColor="White"
1313
Text="Swipe the CarouselView to select the item numbered 2. Then, tap the Hide Button to hide the Carousel and the Show Button to show the Carousel again. If the position of the Carousel is the same as before hiding, the test has passed."/>
14-
<!-- This functionality failed in CarouselView2. Reference: https://github.com/dotnet/maui/issues/29308 -->
15-
<!-- TODO: Replace CarouselView1 with CarouselView once the issues mentioned in the GitHub issue are resolved. -->
16-
<local:CarouselView1
14+
<CarouselView
1715
AutomationId="TestCarouselView"
1816
x:Name="carousel"
1917
HorizontalOptions="Center"
2018
HeightRequest="500"
2119
ItemsSource="{Binding}">
22-
<local:CarouselView1.ItemTemplate>
20+
<CarouselView.ItemTemplate>
2321
<DataTemplate>
2422
<Label
25-
Text="{Binding}"
26-
FontSize="96"
27-
HorizontalTextAlignment="Center"/>
23+
Text="{Binding}"
24+
FontSize="96"
25+
HorizontalTextAlignment="Center"/>
2826
</DataTemplate>
29-
</local:CarouselView1.ItemTemplate>
30-
</local:CarouselView1>
27+
</CarouselView.ItemTemplate>
28+
</CarouselView>
3129
<Label
3230
AutomationId="CarouselPosition"
3331
Text="{Binding Source={x:Reference carousel}, Path=Position}"

0 commit comments

Comments
 (0)