0

I have Pivot with two PivotItems. On each PivotItem I have ListView with different ItemsSources.

Fist ListView have this binding:

Items = new IncrementalLoadingCollection<MainPageViewModel, Item>(this, 5);

public async Task<IEnumerable<Item>> GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = default(CancellationToken))
    {
        *here network request*
        return itemsList;
    }

IncrementalLoadingCollection - collection from UWPCommunityToolkit How can I implement same Items2 = new IncrementalLoadingCollection(this, 5); with different network logic on same VM?

Dmitry
  • 1,095
  • 14
  • 21
  • 1
    If you look at the sample and the docs of the uwp incremental loading https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Incremental%20Loading%20Collection/IncrementalLoadingCollectionPage.xaml.cs you will see they use a separate Source object that is use to bind to list views and it has it's own network handling. So you'll need 2 of those sources – Depechie Dec 21 '16 at 13:07
  • Both sources one same VM. Items = new IncrementalLoadingCollection(**this**, 5); I can't create separate class with source. VM contain injected properties for access to network. – Dmitry Dec 21 '16 at 13:58
  • If you use dependency injection you could just inject the network access in the separate sources too – Depechie Dec 21 '16 at 13:59
  • IncrementalLoadingCollection source class must be parameterless – Dmitry Dec 21 '16 at 14:43
  • Not saying it has to be constructor injection... depending on the ioc you are using you should be able to request a needed interface in code, not as method param – Depechie Dec 21 '16 at 14:45

0 Answers0