windows-8microsoft-metro

Clearing ISupportIncrementalLoading


I have created a search page in a Windows 8 Style App. I have implemented ISupportIncrementalLoading and when the user scrolls the paging works great.

The problem that I'm having is when a user does a second search. I apparently don't know how to get the LoadMoreItemsAsync to fire again. I've tried the following:

1) Clear the underlying collection that is Observable and supports ISupportIncrementalLoading. This clears all items from screen so I know it is bound properly.

2) Replace the underlying collection instance entirely that implements ISupportIncrementalLoading and raise INotifyPropertyChanged so the view knows the property was changed. This also, clears all the items from the screen.

However, the LoadMoreItemsAsync doesn't want to fire after clearing or replacing the underlying collection instance. My hunch is that the UI doesn't think it needs to Load any more, but since I've clear all the items it should want to load more.

I have verified that the HasMoreItems property is set to true.

If it would help, regrettably, you can see the error in production if you download FlixPicks from the Windows 8 store. The steps to reproduce are:

  1. Search using windows search contract
  2. Notice paging works From the Search page
  3. Search again.
  4. Notice all items are cleared. (At this point the LoadMoreItemsAsync is not firing)

Thanks for any advice you can provide!


Solution

  • This definitely looks like a bug. To solve this, add the following line after resetting your collection (in any of the cases):

    gv.LoadMoreItemsAsync();
    

    You can probably inherit from the control and create some overrides that will do this automatically: