Carousel View in Xamarin.Forms iOS

OzmertDenizOzmertDeniz USMember
edited August 2016 in Xamarin.Forms

Hi, I have a web service and I'm getting imageurl from json string. But I guess wrong binding section. There isn't show any image. Here is my code.

Xaml:

    <cv:CarouselView ItemsSource="{Binding Path=BindingContext.Hotel.HotelImages, Source={x:Reference HotelDetailPage}}" HeightRequest="200">
            <cv:CarouselView.ItemTemplate>
              <DataTemplate>
                <StackLayout HeightRequest="200">
                  <Grid HeightRequest="200">
                    <Image Aspect="AspectFill" Source="{Binding FullPath}"/>
                  </Grid>
                </StackLayout>
              </DataTemplate>
            </cv:CarouselView.ItemTemplate>
          </cv:CarouselView>

and here is my get json service code;

                     for (int j = 0; j < imageCount; j++)
                                {
                                    HotelImageModel hotelImage = new HotelImageModel();

                                    hotelImage.FullPath = json["data"][i]["HotelImages"][j]["FullPath"].Value;

                                    hotel.HotelImages.Add(hotelImage);
                                }

Note: I got help at this example: https://blog.xamarin.com/flip-through-items-with-xamarin-forms-carouselview

Sign In or Register to comment.