我想实现数据虚拟化,但是我不知道在这个示例中将我的真实数据集合放在哪里:http://blogs.msdn.com/b/ptorr/archive/2010/08/16/virtualizing-data-in-windows-phone-7-silverlight-applications.aspx
发布于 2011-06-18 04:23:49
假设您的集合是List,其中Person是您定义的自定义类。
您应该从服务或独立存储中读取一小部分数据,并按如下方式进行设置。
在VirtualizedDataSource.cs文件中,将"this“属性的getter更新为
if (itemToReturn == null)
{
if (simpleCache.Count >= CACHE_SIZE)
{
DataItem oldItem = simpleCache.Dequeue();
Debug.WriteLine("Purging\t" + oldItem.Index + "\t" + oldItem.Text);
oldItem.Text = "DEAD ITEM";
}
itemToReturn = **new Person();**
text += "\t" + itemToReturn.Text;
simpleCache.Enqueue(itemToReturn);
}希望这能有所帮助。
https://stackoverflow.com/questions/6384606
复制相似问题