InfiniteScrollItem

You may be still wondering how to put all this together and I will try to explain it to you right now.

Once you have your ScrollRect with an InfiniteScroll attached and ready, you’re almost there.

But first you will need to decide how the scroll elements are going to be presented and create a prefab which will be used as a template. You can make this as complicated as you may need: you can use the prefab to load another one depending on the model’s properties, for example.

The prefab needs to have a custom InfiniteScrollItem script. The InfiniteScrollItem will do the binding between your models and the UI (prefab). InfiniteScrollItem extends Bindable class and adds click events to it so all you have to do is extend InfiniteScrollItem as we did previously with Bindable class to create our Binder class.

Then remember to use the conventions I have exposed in previous chapters and create the SetBinding methods you may need. Remember that you will have a DataContext property containing the model so if you need to do two-way databind you can do it here, too.