MAUI CarouselView does not show anything on iOS

Maximilian Grabner 5 Reputation points
2024-08-16T11:25:15.0866667+00:00

Hi

Slowly I am getting the feeling, that iOS want to be special as Apple always want to be..

I am now facing the issue, that my carouselView shows and uses its defined space, but does not show the elements in the dataTemplate defined.

For test purposes, i defined the ItemsSource directly in my xaml-file. But even this strings does not appear as you can see in the following screenshot. :/

Simulator Screenshot - iPhone 15 Pro Max - 2024-08-16 at 13.21.04

This is my xaml-code:

<CarouselView IsVisible="{ Binding PopupHasImage, Source={x:Reference Root} }"
			  Loop="False"
			  HeightRequest="190"
			  Margin="-15,-5,-15,5"
			  IndicatorView="indicatorView">
			  <!--="{ Binding ImageSources, Source={x:Reference Root} }">-->
	<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:Array>
	</CarouselView.ItemsSource>
	<CarouselView.ItemTemplate>
		<DataTemplate>
			<Grid Padding="15,15,15,15">
				<Grid BackgroundColor="#ebebeb">
					<Label Text="{ Binding . }" />
					<!-- <local:LoadingIndicator IsVisible="{ Binding LoadingVisible }"  
											Autostart="True" 
											HorizontalOptions="Fill" 
											VerticalOptions="Center" /> -->
					<!-- <Image Aspect="AspectFill"
						   HorizontalOptions="Fill"
						   VerticalOptions="Fill"
						   Source="{ Binding ImageSource }">
						<Image.Behaviors>
							<local:EventToCommandBehavior EventName="PropertyChanged" 
														  Command="{ Binding PropertyChangedCommand }" />
						</Image.Behaviors>
					</Image> -->
				</Grid>
			</Grid>
		</DataTemplate>
	</CarouselView.ItemTemplate>
</CarouselView>

After some difficulties with android with setting the ItemsSource, i managed to get it working.
Hopefully you can help me solve this problem.
Thanks in advance

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-08-19T05:19:39.46+00:00

    Hello,

    =============UPDATE===============

    Updating my .NET version to 8.0.4 on my MacBook did not solve the problem

    Please click the project, choose the Manage NuGet Packages.., then choose Update tab, update your Microsoft.Maui.Controls, Microsoft.Maui.Controls.compatiblity to 8.0.40 or higher(latest version is 8.0.80)

    Firstly, please use <StackLayout> to wrap the <CarouselView> .

    By the way, if you set the Loop="False" in .NET versions prior to 8.0.4, here is a known issue about CarouselView - Content disappears when 'Loop' is false, please update to 8.0.40. And PopupHasImage's value should be true.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.