locked
Problem On Dynamic Loading RRS feed

  • Question

  • Can anyone give me  an example of how to dynamically load items of a ListView with XAML and C#. I ever set the following attribute values as "IncrementalLoadingThreshold="1" DataFetchSize="2" IncrementalLoadingTrigger="Edge"" in the hope of dynamically loading the out-of-boundary items when I had dragged the scroller for a certain distance.My data sources to load are pictures added in my project.

    Tuesday, September 25, 2012 8:09 AM

Answers

  • For this to work, you have to implement the ISupportIncrementalLoading interface. There is an example here. And the interface looks something like:

        // Summary:
        //     Specifies a calling contract for collection views that support incremental
        //     loading.
        public interface ISupportIncrementalLoading
        {
            // Summary:
            //     Gets a sentinel value that supports incremental loading implementations.
            //
            // Returns:
            //     True if additional unloaded items remain in the view; otherwise, false.
            bool HasMoreItems { get; }
    
            // Summary:
            //     Initializes incremental loading from the view.
            //
            // Parameters:
            //   count:
            //     The number of items to load.
            //
            // Returns:
            //     The wrapped results of the load operation.
            IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count);
        }
    Hope it helps...


    Can Bilgin
    Blog CompuSight

    • Proposed as answer by Can Bilgin Thursday, October 4, 2012 1:56 PM
    • Marked as answer by Min ZhuMember Friday, October 5, 2012 8:39 AM
    Tuesday, September 25, 2012 10:00 AM

All replies

  • For this to work, you have to implement the ISupportIncrementalLoading interface. There is an example here. And the interface looks something like:

        // Summary:
        //     Specifies a calling contract for collection views that support incremental
        //     loading.
        public interface ISupportIncrementalLoading
        {
            // Summary:
            //     Gets a sentinel value that supports incremental loading implementations.
            //
            // Returns:
            //     True if additional unloaded items remain in the view; otherwise, false.
            bool HasMoreItems { get; }
    
            // Summary:
            //     Initializes incremental loading from the view.
            //
            // Parameters:
            //   count:
            //     The number of items to load.
            //
            // Returns:
            //     The wrapped results of the load operation.
            IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count);
        }
    Hope it helps...


    Can Bilgin
    Blog CompuSight

    • Proposed as answer by Can Bilgin Thursday, October 4, 2012 1:56 PM
    • Marked as answer by Min ZhuMember Friday, October 5, 2012 8:39 AM
    Tuesday, September 25, 2012 10:00 AM
  • Thank you so much for your answer,  It really helps me.
    Monday, October 8, 2012 1:43 AM