Search code examples
c#xamarinuwpprinter-control-language

Cross-platform implementation of incremental loading


Currently I'm porting my UWP app to reference a cross-platform PCL that consists all the logic. While this works great, I am struggling with platform-specific implementations like the ISupportIncrementalLoading interface on the UWP platform.

The problem is that the PCL contains a ViewModel (called MainViewModel). This ViewModel has a property called Items which is basically an ObservableCollection<ItemViewModel>. The ListView control of the UWP platform does support incremental loading, if the underlying collection implements the ISupportIncrementalLoading interface.

What is the best approach to implement this interface while keeping as much as possible of the shared logic?


Solution

  • Even if that's not a real solution, my approach was to kick the incremental loading logic out of the PCL, so that the MainViewModel.Items property contained all the items. I've then created a new UWP MainViewModel which then handles the incremental loading logic using the ISupportIncrementalLoading Interface.