WP7 Mango 中的列表框是否默认虚拟化? [英] Is listbox virtualized by default in WP7 Mango?

查看:28
本文介绍了WP7 Mango 中的列表框是否默认虚拟化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本文于 2012 年 8 月发布http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286406%28v=vs.92%29.aspx,其中讨论了数据库最佳实践.

In august 2012, this article was published http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286406%28v=vs.92%29.aspx which talks about database best practices.

在本文中,提到必须启用列表框中的数据虚拟化,并建议关注 2010 年 8 月的一篇文章.

In this article, is mentioned that data virtualization in listbox must be enabled and suggests to follow an article dated August 2010.

" 有关在数据绑定 ListBox 控件上启用数据虚拟化的更多信息,请参阅 改进 Silverlight 中的 ListBox 性能 for Windows Phone 7:数据虚拟化"

" For more information about enabling data virtualization on data-bound ListBox controls, see Improving ListBox Performance in Silverlight for Windows Phone 7: Data Virtualization"

但是我认为默认情况下启用了 Mango 版本中发布的列表框虚拟化.那是对的吗?绑定到可观察集合的列表框是否默认虚拟化?

However I thought that listbox virtualization is enabled by default with what was released in Mango version. Is that correct? Is a listbox databinded to an observable collection virtualized by default?

推荐答案

默认情况下 Ui 是虚拟化的 - 因此列表框重用列表项的数据模板,并且只呈现那些实际滚动到视图中的列表项.

The Ui is virtualised by default - so the list box reuses datatemplates for the list items, and only renders those list items which are actually scrolled into view.

>

但是,如果您使用的是 observablecollection,那么数据不会被虚拟化.

However, if you are using observablecollection, then the data is not virtualised.

因此,如果您有一个包含 1,000,000 个项目的列表,那么所有项目都将在内存中,但只会创建和绘制其中少数项目的 ui.

So if you have a list of 1,000,000 items, then all of them will be in memory, but only the ui for a few of them will be created and drawn.

为了虚拟化数据,您需要实现自定义 ilist,可能还支持 inotifycollectionchanged.例如,此实现可能使用 SQLite 仅在滚动需要时加载数据项.

To virtualise the data as well, you'll need to implement a custom ilist, possibly also supporting inotifycollectionchanged. This implementation might, for example, use SQLite to just load data items as they are needed by scrolling.

这篇关于WP7 Mango 中的列表框是否默认虚拟化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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