I have an app which gets content from internet. those pieces of information are so large and can\'t fit in memory.
LongListSelector
does UI Virtua
Basic idea of data virtualization is creating custom collection that can load & return item(s) on-demand (without prior loading complete set in memory). Following is radically simplified implementation (adapted from this blog post) :
namespace VirtualizingDataTest
{
public class VirtualizedDataSource : IList
{
public object this[int index]
{
get
{
string text = "Requesting\t" + index;
Debug.WriteLine(text);
return "Item " + index;
}
set
{
throw new NotImplementedException();
}
}
}
In the sample above, new item created upon requested. In your case, if the online source provide a way to request item in specific index, you don't need database. You can put logic to download specific item in this[]
getter. Further references (various better/more complete implementation) can be found here : https://stackoverflow.com/a/6712373/2998271
Given UI virtualization working, LLS will request only sub set of items to be displayed (in other words, this[]
getter won't get invoked for all index available, only those to be displayed).