My carousel no change of position when i set the value of property from code

fmaster_icfmaster_ic Member ✭✭
edited December 4 in Xamarin.Forms

Im have a carousel (https://github.com/alexrainman/CarouselView) where the user can see samples, these samples are added one by one, and the user could see the last one created each time that he press the button, in android the project works fine, but in iOS the carousel has a very strange behavior, because when user press button add(see below) in the carousel only appears the first and last elements in the item source :S

I attached some code to understand better this situation.

xmla page

<controls:CarouselViewControl x:Name="cvSamplings" ItemsSource="{Binding ListSamplings, Mode=TwoWay}" PositionSelected="cvSamplings_PositionSelected"
                                      Orientation="Horizontal" InterPageSpacing="10" Position="{Binding MyPosition,Mode=TwoWay}"                                        
                                      VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">

code to change current position

var index = viewModel.AddSample();
BindCarouselView();
viewModel.MyPosition = index;

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    How do you add views from BindCarouselView(); and what does this index represent for?
    I created a project based on the sample above. It runs fine on iOS and we could reach the end of the carousel view:

  • fmaster_icfmaster_ic Member ✭✭
    edited December 5

    @LandLu said:
    How do you add views from BindCarouselView(); and what does this index represent for?
    I created a project based on the sample above. It runs fine on iOS and we could reach the end of the carousel view:

    i've attached my project, please could you check my solution? thanks!

Sign In or Register to comment.