水平列表视图 Xamarin.Forms [英] Horizontal ListView Xamarin.Forms

查看:27
本文介绍了水平列表视图 Xamarin.Forms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以像图像一样在 Xamarin.Forms 中使用 horizo​​ntal scroll 创建 ListView

Is any way to create ListView with horizontal scroll in Xamarin.Forms like image

这就是我为垂直所做的

var myListView = new ListView
{
    ItemTemplate = new DataTemplate(typeof(ImageCell))
};

推荐答案

从 Xamarin Forms 2.3 开始,CarouselView 就可以做到这一点,还有更多.在此处阅读更多信息.

As of Xamarin Forms 2.3 CarouselView does just that, and more. Read more here.

<ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
  <CarouselView ItemsSource="{Binding MyDataSource}">
    <CarouselView.ItemTemplate>
      <DataTemplate>
        <Label Text="{Binding LabelText}" />
      </DataTemplate>
    </CarouselView.ItemTemplate>
  </CarouselView>
</ContentView>

这篇关于水平列表视图 Xamarin.Forms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆