在后台加载整个 ListView 并在每个 ListItem 中获取一个 UIControl [英] load the entire ListView in background and get an UIControl inside each ListItem

查看:13
本文介绍了在后台加载整个 ListView 并在每个 ListItem 中获取一个 UIControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使项目视图未显示在屏幕上,我也需要完全加载 ListView 并在每个 ListItem 中获取一个 UIControl.

I need to load a ListView entirely and get an UIControl inside each ListItem even if the item view is not displayed on the screen.

我尝试了 ChildViewAdded 事件,但仅当 ListItem 显示在屏幕上时才会引发该事件.

I tried the ChildViewAdded event, but it is raised only when the ListItem is displayed on the screen.

因此,我需要一种在显示之前以编程方式准备 UI ListView 的方法.

So, I need a way to prepare my UI ListView programmatically before displaying it.

预先感谢您的帮助.

推荐答案

快速回答 - 如果您需要为列表中的每个项目提供一个真实的 View,那么您就不想使用像 ListView 这样的虚拟化控件.

Quick answer - if you need a real View for each item in your list then you don't want to use a virtualized control like a ListView.

相反,您可以在 ScrollView 内的垂直 LinearLayout 内使用重复的自定义视图.

Instead you can use repeated custom views inside a vertical LinearLayout inside a ScrollView.

如果使用 mvvmcross,您可能会发现 MVXBindableLinearLayout 有助于做到这一点 - 它有一个 ItemsSource 和一个模板,就像 MvxBindableListView 一样.

If using mvvmcross, you may find a MVXBindableLinearLayout helpful to do this - it has an ItemsSource and a Template just like the MvxBindableListView.

我不知道您尝试做的事情是否有意义,但是如果您愿意,以上内容应该可以帮助您做到!

I've no idea whether what you are trying to do makes sense, but the above should help you do it if you want to!

不要尝试对包含大量项目的列表使用线性布局 - 你会耗尽资源.

Don't try using a linear layout for lists with lots of items - you'll run out of resources.

这篇关于在后台加载整个 ListView 并在每个 ListItem 中获取一个 UIControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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