Windows应用商店普遍的应用程序 - ListView的怪胎 [英] Windows Store universal app - ListView oddity
问题描述
我开发一个通用的应用程序,并使用的ListView
来显示超过50000项。我使用下面的方法加载数据:
I am developing an universal app and using a ListView
to display more than 50000 entries. I am using the following method to load the data:
- 在Assets文件夹有一个与所有项目一个简单的UTF-8 txt文件(按字母顺序排列的字典词条的刚需precise)。
-
我的文件到
的IList
与负载ReadLinesAsync
:
IList<string> lista1 = await FileIO.ReadLinesAsync(listafile1);
最后,我设置的ListView的的ItemsSource这个IList的:
Finally I set the ItemsSource of the ListView to this IList:
listView1.ItemsSource = lista1;
这似乎是快速和正常工作,但在项目滚动后消失的列表的末尾。我遇到这种在手机和电脑,甚至在模拟器中了。 我做了它的视频更清晰。
It seems to be fast and work fine but at the end of the list the items are disappearing after scrolling. I experience this on phones and pc and even in the emulator too. I made a video of it to be more clear.
我已经创建了相同的应用程序为Android和iOS并没有遇到这种类型的错误。
I already created the same app for android and ios and didn't experience this type of error.
我想AP preciate任何帮助
I would appreciate any help
伊什特万
推荐答案
解决方案是一个VirtualizingStackPanel XAML中添加的ListView:
The solution is to add a VirtualizingStackPanel to ListView in xaml:
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
这篇关于Windows应用商店普遍的应用程序 - ListView的怪胎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!