Xamarin ListView控件是一个虚拟化的列表组件,用于显示数据列表。它在需要滚动和操作项目的场景中非常有用。该控件易于使用,包含了ListView组件所需的所有内容——数据绑定、按需加载、过滤、分组、排序、使用模板选择器定制项目、线性和网格布局、项目滑动和重排序、各种选择选项、页眉和页脚支持等等。
所有这些都得益于Xamarin中暴露的本地Telerik Android、iOS和UWP ListView控件,具有出色的性能和平台特定的UI。形式,Xamarin的。iOS和Xamarin。安卓,both in Visual Studio and Visual Studio for Mac.
除了内置的数据绑定功能外,Xamarin。表单列表视图control supports loading data on demand, which optimizes the initial loading of the app and the new items are loaded only when needed – for example when the user reaches the bottom of the ListView or asks for more items. Fine grain control is provided with the option to define the number of loaded items, the built-in loading indicator, and the automatic and manual loading configurations.
Telerik ListView具有两种类型的单元格——TextCell,它显示文本和可选的详细文本,以及TemplateCell,它可以自定义显示任何内容。通过对ItemTemplateSelector的支持,可以定义不同的项模板,并根据所显示的项选择在运行时显示哪个项。
Xamarin的ListView控件。形式supports linear and grid layouts. The linear layout arranges the items in a one-column list, while the grid layout arranges the items in a predefined number of columns, expanding the columns and their items to take up the width of the ListView. These layouts can arrange the items in the ListView horizontally or vertically, and also allow for fine grain control over the item’s size, spacing as well as the group header size.
关于Xamarin ListView布局类型的文档
Xamarin的这个特性。表单列表视图control keeps the group item in view while scrolling through a list of items until the next grouped items reaches the top. The feature is especially useful for mobile application scenarios when there are many items in a group as it keeps the user informed in which group they are currently browsing通过。
ListView for Xamarin。iOS为Xamarin扩展了标准的UICollectionView和ListView。Android扩展了Android RecyclerView。这甚至为大型数据集提供了快速加载和平滑滚动的体验。
通过ListView中的展开/折叠组功能,控件可以以一种方便的方式显示更多的项,方法是将它们分布在分级可折叠组中。可以通过编程方式或通过用户交互展开/折叠组。
Telerik ListView控件中的条目滑动手势使终端用户能够滑动条目来显示上下文操作(例如,在电子邮件中将条目标记为阅读和删除)。当用户滑动项目时,上下文视图会沿着滑动的方向移动,显示一个指定的区域,其中可以放置任何视图,如按钮、图像等。
文档关于Xamarin ListView上下文操作和项目滑动
ListView项目重新排序功能在与内容交互时提供了额外的灵活性,它允许通过按住项目并将其移动到所需的新位置来重新排序项目。
关于Xamarin ListView项目重新排序的文档ListView的Xamarin船拉刷新功能开箱即用,允许用户获取最新的数据通过滚动到列表的顶部和下拉。Telerik拉刷新功能提供了一个内置的载入指示器,这是高度可定制的。
关于Xamarin ListView Pull to Refresh的文档
ListView组件提供了内置的header和Footers模板,使用户可以轻松地在Xamarin中的项的上方和下方添加自己选择的内容。窗体ListView控件。
当最终用户向上或向下滚动时,ListView使项目在屏幕上显示的方式具有动画效果。支持的动画效果是:缩放,渐隐,滑动或者适当的组合。
Xamarin的Telerik ListView控件。形式features a built-in styling mechanism for customizing the look of the control and its items with the already familiar approach of using StyleClass and resources. Utilizing the theming concept makes it easier to implement corporate branding in a mobile application or to achieve the same look and feel on both Android and iOS.
关于Xamarin ListView的文档产品风格而且ItemTemplateSelector