locked
Data Virtualization -

    Question


  • I have been using the XAML DataBinding example as a starting point and I have something sort of working.  I have a large number of photos to display, I use a ListView and ISupportIncrementalLoading.

    When I get to about 70 photos it stops functioning properly - the list shows just a grey box for the photos.

    The XAML DataBinding example shows how to do incremental loading - this I understand.  Now I am looking for an example of how the DataVirtualization part is supposed to work.

    There are a few out of date examples on the web - I could not find a recent example for Win 8.1 Store App.  Can anyone point me to an example?

    Thanks,

    Frank

    Thursday, August 28, 2014 8:20 PM

Answers

  • Hi Frank,

    Let's say here are two ways of data virtualization:Random access virtualization and Incremental virtualization. Which one you want to find the sample?

    Random access virtualization

    Random access data virtualization lets you retrieve a subset of data from anywhere in the complete data set. For example, if a ListView is bound to a collection of 100,000 items and the user scrolls to the middle of the collection, your app might download only items 50,000 – 50,050. If they then scroll to the end of the list, the app downloads items 99,950 – 100,000. The scroll bar's scroll indicator, or thumb, is always sized to represent its position in the complete 100,000 item data set.

    To use random access data virtualization, you must use a data source that implements INotifyCollectionChanged and IObservableVector.

    Incremental virtualization

    With incremental data virtualization, your app downloads data sequentially.  For example, if a ListView is bound to a collection of 100,000 items, your app might download only items 1-50. The scroll bar's thumb is sized to represent its position in the initial 50 item data set. When the user scrolls near the end of the list, items 51 – 100 are downloaded. The scroll bar's thumb is resized to represent its position in the updated 100 item data set.

    To use incremental data virtualization, you must use a data source that implements ISupportIncrementalLoading. When you use incremental data virtualization with a ListView or GridView, you can use these members to control data loading: DataFetchSize, IncrementalLoadingThreshold, IncrementalLoadingTrigger, LoadMoreItemsAsync.

    A sample can be found XAML data Binding sample.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 29, 2014 10:24 AM
    Moderator
  • Hi Frank,

    Alright, I understand your question, indeed if you read into the sample we should be able to find following code:

                employees = new GeneratorIncrementalLoadingClass<Employee>(1000, (count) => {
                    return new Employee() { Name = "Name" + count, Organization = "Organization" + count };
                });

    GeneratorIncrementalLoadingClass is the key to manage the maximum count (this is what you mentioned here 49,000 elements are not kept in memory), try to find GeneratorIncrementalLoadingClass.cs file in the sample project to read more about how it manage the binding source.

    You could set a much bigger number for instance 10,000 if you need.

    For the Random Access Virtualization I could not find an example from MSDN, but I can only find this: Create and Bind to an ObservableCollection

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 3, 2014 1:02 PM
    Moderator

All replies

  • Hi Frank,

    Let's say here are two ways of data virtualization:Random access virtualization and Incremental virtualization. Which one you want to find the sample?

    Random access virtualization

    Random access data virtualization lets you retrieve a subset of data from anywhere in the complete data set. For example, if a ListView is bound to a collection of 100,000 items and the user scrolls to the middle of the collection, your app might download only items 50,000 – 50,050. If they then scroll to the end of the list, the app downloads items 99,950 – 100,000. The scroll bar's scroll indicator, or thumb, is always sized to represent its position in the complete 100,000 item data set.

    To use random access data virtualization, you must use a data source that implements INotifyCollectionChanged and IObservableVector.

    Incremental virtualization

    With incremental data virtualization, your app downloads data sequentially.  For example, if a ListView is bound to a collection of 100,000 items, your app might download only items 1-50. The scroll bar's thumb is sized to represent its position in the initial 50 item data set. When the user scrolls near the end of the list, items 51 – 100 are downloaded. The scroll bar's thumb is resized to represent its position in the updated 100 item data set.

    To use incremental data virtualization, you must use a data source that implements ISupportIncrementalLoading. When you use incremental data virtualization with a ListView or GridView, you can use these members to control data loading: DataFetchSize, IncrementalLoadingThreshold, IncrementalLoadingTrigger, LoadMoreItemsAsync.

    A sample can be found XAML data Binding sample.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 29, 2014 10:24 AM
    Moderator
  • Hi James,

    Thanks for your assistance.

    My problem has to do with Incremental Virtualization.  And, I am using the XAML data Binding sample as my base.  

    In the case of Incremental Virtualization (IV), what happens as the user scrolls down to lets say the 50,000th  element?  Surely the previous 49,000 elements are not kept in memory - who manages this aspect?  All I provide is "loadMoreItemsAsync()" - I do not see any mechanism to discard the oldest x items as I scroll down the list.  Kind of a long winded way of asking who is doing the memory management for the list when IV is used?

    Is there another example that you can point me to other than XAML data Binding sample?

    Is there an example of Random Access Virtualization that you can point me to?

    Many thanks,

    Frank

    Friday, August 29, 2014 1:32 PM
  • Hi Frank,

    Alright, I understand your question, indeed if you read into the sample we should be able to find following code:

                employees = new GeneratorIncrementalLoadingClass<Employee>(1000, (count) => {
                    return new Employee() { Name = "Name" + count, Organization = "Organization" + count };
                });

    GeneratorIncrementalLoadingClass is the key to manage the maximum count (this is what you mentioned here 49,000 elements are not kept in memory), try to find GeneratorIncrementalLoadingClass.cs file in the sample project to read more about how it manage the binding source.

    You could set a much bigger number for instance 10,000 if you need.

    For the Random Access Virtualization I could not find an example from MSDN, but I can only find this: Create and Bind to an ObservableCollection

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 3, 2014 1:02 PM
    Moderator