Issue in indicatorView

MCApp 21 Reputation points
2021-05-02T14:30:25.457+00:00

Hello.

I'm implementing CarouselView in my Xamarin.forms app.

I'd like to insert Indicator View. I followed instructions and official sample but I get issue for iOS.

<CarouselView ItemsSource="{Binding ImageSourcesURL}"  
                                          Loop="False"  
                                              IndicatorView="indic"  
                                          >  
                                    <CarouselView.ItemTemplate>  
                                        <DataTemplate>  
                                            <StackLayout>  
  
                                                <Image Source="{Binding .}"  
                                                     
                                                    Aspect="AspectFill"  
                                                    HeightRequest="400"  
                                                    WidthRequest="400"  
                                                    HorizontalOptions="Center"/>  
  
                                            </StackLayout>  
                                        </DataTemplate>  
                                    </CarouselView.ItemTemplate>  
                                </CarouselView>  
  
                                <IndicatorView x:Name="indic"  
                                                 
                                       IndicatorColor="LightGray"  
                                       SelectedIndicatorColor="DarkGray"  
                                       HorizontalOptions="Center" />  

Very simple code. Android works, iOS doesn't.

I attached image of error

Any idea?

93171-schermata-2021-05-02-alle-161726.png

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,756 Reputation points
    2021-05-03T02:32:13.047+00:00

    Hello,

    Welcome to Microsoft Q&A!

    I test your code and official sample, it both works fine without error .

    allowsContinuousInteraction is only available from iOS 14, so I check the source code of IndicatorViewRenderer ,

       if (Forms.IsiOS14OrNewer)  
       {  
       	UIPager.AllowsContinuousInteraction = false;  
       	UIPager.BackgroundStyle = UIPageControlBackgroundStyle.Minimal;  
       }  
    

    Everything seems to be working , would you mind sharing us a basic, reproducible project(you can upload to github and attach the link here) ?

    Best Regards,
    Cole Xia


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.