简体   繁体   English

WP7实现数据虚拟化

[英]WP7 implementing data virtualization

我想实现数据虚拟化,但在此示例中我不知道将真正的数据收集放在何处: 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. 假设您的集合是List,其中Person是您定义的自定义类。

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 在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);
 }

Hope this helps. 希望这可以帮助。

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

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