Xamarin表单CarouselView一次只能滑动一个元素



在我的Xamarin。窗体项目我需要一个水平旋转木马在一个时间只有一个元素的滑动。可以通过CarouselView实现吗?建议吗?

这是我当前的CarouselView定义:

<CarouselView AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1"
ItemsSource="{Binding Homes}" ItemTemplate="{StaticResource HomeTemplate}"
PeekAreaInsets="0" IsSwipeEnabled="True" Loop="False" IsScrollAnimated="False" ItemsUpdatingScrollMode="KeepItemsInView" HorizontalScrollBarVisibility="Never" VerticalScrollBarVisibility="Never">
<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="0"  />
</CarouselView.ItemsLayout>
</CarouselView>

可以设置SnapPointsTypeMandatorySingle.表示与Mandatory相同的行为,但一次只能滚动一个项目。

<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="0" SnapPointsType="MandatorySingle"  />
</CarouselView.ItemsLayout>

最新更新