简体   繁体   English

WP7列表框滚动

[英]WP7 Listbox scrolling

I created a simple application with nested ListBox and strings in it. 我创建了一个带有嵌套ListBox和字符串的简单应用程序。 If i scroll it really fast - there is empty spaces.Can i increase the rendering speed or Can i slow down scrolling speed in ListBox somehow ? 如果我真的快速滚动-则有空白。我可以提高渲染速度还是可以降低ListBox中的滚动速度?

Inorder to overcome the black occurrence on scrolling you need to virtualize your scroll control. 为了克服滚动时出现的黑色现象,您需要虚拟化滚动控件。 For that you should inherit IList and create a Collection of your own similar to ObservableCollection in which you will have to override the default indexer depending on your caching requirement and simultaneously maintain a cache for your items. 为此,您应该继承IList并创建类似于ObservableCollection的自己的Collection,在其中您必须根据缓存要求覆盖默认索引器,并同时维护项目的缓存。 I feel this might be what you are looking for: http://blogs.msdn.com/b/ptorr/archive/2010/08/16/virtualizing-data-in-windows-phone-7-silverlight-applications.aspx 我觉得这可能就是您要寻找的内容: http : //blogs.msdn.com/b/ptorr/archive/2010/08/16/virtualizing-data-in-windows-phone-7-silverlight-applications.aspx

There is a sample project on that page. 该页面上有一个示例项目。 Try that out. 试试看。

I also feel that you are facing this problem http://blog.rsuter.com/?p=258 . 我也觉得您正在面对这个问题http://blog.rsuter.com/?p=258 I guess this will be solved using virtualization itself. 我想这将使用虚拟化本身解决。 Hope it helps 希望能帮助到你

The blog Milan posted is a good source to start with. 米兰发布的博客是一个很好的起点。 Virtualizing data works by changing the item template of the list item while scrolling. 通过滚动时更改列表项目的项目模板来对数据进行虚拟化。 This will not work up to the expectations when there is a complex layout. 布局复杂时,这将达不到预期的效果。

But I suggest you work more on the layout you are working on. 但我建议您在正在处理的布局上做更多的工作。 Having too many stack panels in order to make the layout a bit generic will destroy the performance. 为了使布局有点通用而使用过多的堆叠面板会破坏性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM