ユーザーがリストからイメージを選択すると、カルーセルビューは開始時に選択したインデックスのイメージを表示するカルーセルビューを実装しようとしています。カルーセルビューで選択したインデックスから開始する方法Xamarinフォーム
私の試み:私のコードで
私が選択したインデックスに位置フィールドを設定していますが、その私のために働いていません。また、カルーセルビューに関連する他のフィールドは、インデックス番号または一致するオブジェクトから選択したインデックスに移動することはありません(私が何かを忘れていない限り)。
相続人はこれまでのところ、私のコード:相続人はバックエンド
public partial class ImagePreview : ContentPage
{
int index;
public ImagePreview(Picture photo, int i)
{
InitializeComponent();
this.index = i;
photo_carousel.Position = index;
photo_carousel.ItemsSource = App.rug.photos;
}
}
:
それは初期ロード上の位置にスクロールしないiOS
に
Xamarin.Forms Carousel Viewにバグが現在あり
<ContentPage.Content>
<cv:CarouselView x:Name="photo_carousel">
<cv:CarouselView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Grid.RowSpan="2" Aspect="AspectFill" Source="{Binding ImageUri}"/>
<StackLayout Grid.Row="1" BackgroundColor="#80000000" Padding="12">
<Label TextColor="White" Text="{Binding Date}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
<Label TextColor="White" Text="{Binding Length}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
</StackLayout>
</Grid>
</DataTemplate>
</cv:CarouselView.ItemTemplate>
</cv:CarouselView>
</ContentPage.Content>
あなたはこれをどのプラットフォームで実行していますか? – user1
Xamarin Studio。これはフォームプロジェクトですが、カルーセルはiOSの実装用です – Bjt1776