Home > database >  xamarin how to set carouselview currentpage on startup
xamarin how to set carouselview currentpage on startup

Time:08-18

hi im using this carouselview: https://stackoverflow.com/a/64639210/18463835

and I want to set 3th page on carousel view home page when opening page but I can't. im tried this:

            MainPageCarouselView.CurrentItem = 2;

its not working. i have 5 pages now but i think all pages is 10 , i want set main carouselView item to center on first start, also set indicator view to center page. my carouselView:

<CarouselView
  x:Name="MainPageCarouselView"
  IndicatorView="{x:Reference MainContentPageViewIndicatorView}"
  IsSwipeEnabled="True"
  ItemTemplate="{StaticResource MainContentPageViewSelector}"
  ItemsSource="{Binding _mainContentPageViewItemsSource}"
  Loop="True"
  PeekAreaInsets="35"/>
  
<IndicatorView
  x:Name="MainContentPageViewIndicatorView"
  Margin="0,50,0,80"
  HorizontalOptions="FillAndExpand"
  IndicatorColor="White"
  IndicatorsShape="Circle"
  SelectedIndicatorColor="Black"
  VerticalOptions="EndAndExpand"/>

now have 5 pages but its will 10 and this is on center page i want make this page on center

CodePudding user response:

just set;

MainPageCarouselView.Position = 2;
  • Related