xamarin.forms - Xamarin.Forms: CollectionView v/s ListView v/s TableView
问题描述
I want to display content of a book in my Xamarin Forms app. For the time being, I used ListView
. But the ListView
cannot have multiple data items bound to single row.
In ListView
, I could make as below:
Sl No
Chapter
Page No
But I need the data as follows:
Sl No Chapter Page No
And I need the above header to be shown always. And the data may be furnished with backgrounds.
Now, I checked CollectionView
and TableView
, and I confused to choose in between.
解决方案
Well as docs say, TableVies has no ItemsSource, so you have to manually insert everything. I would recommend CollectionView, it has a lot of useful stuff like aligning items vertically or horizontally and much more.
If you want header, just use CollectionView.Header (and also Footer) and play around.
推荐阅读
- kubernetes - 在 KubernetesExecutor 上运行气流时出现气流错误“找不到 dag_id”
- .net - 无法在 Azure Devops 上使用 DotNetCoreCLI 任务恢复 .Net Core 解决方案
- python - 如何跟踪矩阵中的路径?
- sql - 我正在从视图中删除带有检查选项的约束,但它没有被强制执行
- sql - 为什么我在 SQL 中连接两个表时主键重复?
- c++ - 在管道之前应用投影以查看或操作
- node.js - 将承诺插入到预先存在的功能中
- python - 在张量流中保存和加载模型
- mysql - 插入带有 where 子句的 sql 语句
- angular - Angular 10 应用程序不会在跨域请求中发送 JWT 刷新令牌