Home > OS >  CarouselView Xamarin forms indicator view not showing
CarouselView Xamarin forms indicator view not showing

Time:04-15

Im trying to see the indicator views , but for some reason I cant see them , also , I tried horizontals options : fill and expand , it does work on ios on landscaping orientation.However, I cant get it to expand when the android is on landscape

this is what I have

<StackLayout HorizontalOptions="FillAndExpand">
   <CarouselView EmptyView="No items to display."  IndicatorView="indicatorView" ItemsSource="{Binding CarouselImages}">
    <CarouselView.ItemTemplate>
        <DataTemplate>
            <StackLayout HorizontalOptions="StartAndExpand" >
                 <Image Source="{Binding ImagePath}"
                               Aspect="AspectFill"
                               HorizontalOptions="StartAndExpand" />
              </StackLayout>
        </DataTemplate>
    </CarouselView.ItemTemplate>
</CarouselView>
     <IndicatorView x:Name="indicatorView"
                    IndicatorsShape="Square"
                     MaximumVisible="6"
                   IndicatorColor="DarkRed"
                   SelectedIndicatorColor="DarkGray"
                   HorizontalOptions="Center" />

     </StackLayout>

CodePudding user response:

Give it a size , for example IndicatorSize="12"

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/indicatorview#change-indicator-size

  <IndicatorView
            x:Name="indicatorView"
            HorizontalOptions="Center"
            IndicatorColor="DarkRed"
            IndicatorsShape="Square"
            MaximumVisible="6"
            IndicatorSize="12"
            SelectedIndicatorColor="DarkGray" />

CodePudding user response:

Just manage to set the VerticalOptions and HorizontalOptions of the indicatorView to FillAndExpand like below:

<IndicatorView x:Name="indicatorView"
                   IndicatorsShape="Square"
                   MaximumVisible="6"
                   IndicatorColor="DarkRed"
                   SelectedIndicatorColor="DarkGray"
                   VerticalOptions="FillAndExpand"
                   HorizontalOptions="FillAndExpand"
                   />
  • Related