我想实现数据虚拟化,但在此示例中我不知道将真正的数据收集放在何处: http : //blogs.msdn.com/b/ptorr/archive/2010/08/16/virtualizing-data-在Windows Phone 7-silverlight-applications.aspx中
Let us say your collection is List where Person is a Custom Class you have defined.
You should read a small subset of data from either a Service or Isolated Storage and set it as below.
In the VirtualizedDataSource.cs file update the getter of "this" property as under
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);
}
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.