Skip to content
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 @@ -499,6 +499,13 @@ async Task UpdateInitialPosition()
return;
}

if(!ItemsView.IsVisible)
{
// If the CarouselView is not visible we don't want to set the initial position
// since it will be set when the CarouselView becomes visible
return;
}

if (ItemsSource is null)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@
BackgroundColor="Black"
TextColor="White"
Text="Tap the Button. If the item selected in the CarouselView is Item 4, the test has passed."/>
<!-- This functionality failed in CarouselView2. Reference: https://github.com/dotnet/maui/issues/29309 -->
<!-- TODO: Replace CarouselView1 with CarouselView once the issues mentioned in the GitHub issue are resolved. -->
<local:CarouselView1
<CarouselView
x:Name="carousel"
IsSwipeEnabled="True"
Position="3"
IsVisible="False">
<local:CarouselView1.ItemTemplate>
<CarouselView.ItemTemplate>
<DataTemplate>
<Label
Text="{Binding}"
FontSize="Large"
HorizontalOptions="CenterAndExpand"/>
</DataTemplate>
</local:CarouselView1.ItemTemplate>
<local:CarouselView1.ItemsSource>
</CarouselView.ItemTemplate>
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item 1</x:String>
<x:String>Item 2</x:String>
<x:String>Item 3</x:String>
<x:String>Item 4</x:String>
<x:String>Item 5</x:String>
</x:Array>
</local:CarouselView1.ItemsSource>
</local:CarouselView1>
</CarouselView.ItemsSource>
</CarouselView>
<Button
AutomationId="AppearButton"
Text="Appear"
Expand Down