3

I've read through the N+1 video from Stuart and some other tutorials. But none of them seems to cover how to implement a infinite scroll list or push down to refresh list.

I think they are quite common in mobile apps. Can anyone please shed some light on how to do this?

edited: Specific in how to implement it on Android and iOS with MVVMCross

Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
Anthony Wu
  • 63
  • 1
  • 7

3 Answers3

2

I've written an overview of how to achieve infinite scroll with MvvmCross in Android, iOS and Windows, found here: http://www.sequence.co.uk/blog/infinite-scrolling-using-mvvmcross-and-xamarin

Howard
  • 694
  • 5
  • 21
0

Features like infinite scroll and pull down to refresh are native platform features. They will be implemented the same way on each and every platform as you would otherwise without MvvmCross. Then, you would need a facility inside of your custom controls to handle databinding.

If this is of any help, Monotouch.Dialog already has support for pull to refresh. Take a look at this https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/Sample/DemoRefresh.cs

Alexey
  • 732
  • 7
  • 18
  • 1
    There are samples of 'old ways' (pre-ios6) of this type of thing in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Sample%20-%20Tutorial/OldTutorial. For ios6 and later, also see http://motzcod.es/post/59125989518/mvxuirefreshcontrol-for-mvvmcross – Stuart Sep 16 '13 at 16:50
0

I am about to face the same challenge, and the implementation I have in mind, is to create a method on my ViewModel called LoadMore(), and then call it at the right moment from my View.

On Android I guess this would be by adding an IOnScrollListener to the MvxListView and implement it like mentioned in this answer.

If the LoadMore() is then adding to my ObservableCollection of items I would expect the ListView to pick those up as a result of my binding.

I will let you know if this works as soon as I've tried this ;-)

Community
  • 1
  • 1
RickyKaare
  • 38
  • 2
  • 8
  • oh sorry i totally forgot about this post. I actually have done it on both iOS and Android platform already. Your though is pretty close. There are two basic ways. 1st is to detect the position of the item current being view and compare it with the list size. If it's close to the end, add more items to the list. Another way is to detect the footer view being displayed or not to determine whether bottom has been reached. I will post more detail later when I get a chance. This is for infinite scroll. As for pull down to refreh, you can follow Staurt's comment below. – Anthony Wu Oct 21 '13 at 20:50