2016-08-03 9 views
1

イメージスライダを行いたい。しかし、私はxaml側にもっと多くの画像を表示することができませんでした。ここに私のコードです。Xamarin.Forms Image Slider in Xaml

XAML:

 <Image //first image 
       Aspect="AspectFill" 
       Source="{Binding Hotel.HotelImages[0].FullPath}" /> 

    <Image //second image 
       Aspect="AspectFill" 
       Source="{Binding Hotel.HotelImages[1].FullPath}" /> 

私はこれをしようとすると、それは私の最後の画像を表示しますが、私は、カルーセルのようにそれらの両方を表示したいです。

[1]:[http://i.stack.imgur.com/C74tr.png ----私はこの

ようにしたい[2]:http://i.stack.imgur.com/ElnFn.png ----その私のページ

+0

あなたが持っているものは明らかではありませんそこ。あなたの画像はグリッドまたはスタックレイアウト内にありますか?すべてのあなたのcontentpage xamlコードを追加してください。 – batmaci

答えて

0

あなたはXlabsからImageGalleryを試すことができます。あなたの写真から

0

、あなたはXamarinから "新しい" Xamarin.FormsCarouselViewを使用することができますように見える:

Nuget:CarouselView

参考:https://blog.xamarin.com/flip-through-items-with-xamarin-forms-carouselview/

<cv:CarouselView ItemsSource="{Binding Zoos}" x:Name="CarouselZoos"> 
    <cv:CarouselView.ItemTemplate> 
     <DataTemplate> 
     <Grid> 
      <Grid.RowDefinitions> 
      <RowDefinition Height="*"/> 
      <RowDefinition Height="Auto"/> 
      </Grid.RowDefinitions> 
      <Image Grid.RowSpan="2" Aspect="AspectFill" Source="{Binding ImageUrl}"/> 
      <StackLayout Grid.Row="1" BackgroundColor="#80000000" Padding="12"> 
      <Label TextColor="White" Text="{Binding Name}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/> 
      </StackLayout> 
     </Grid> 
     </DataTemplate> 
    </cv:CarouselView.ItemTemplate> 
    </cv:CarouselView>