OSATParams, TItemViewsHolderOnItemIndexChangedDueInsertOrRemove Method |
Called when an insert or remove event happens. You'll only need this if some of your views depend on the item's index itself as opposed to depending only on the model's data
For example, if your item is from a leaderboard and each player's place is given by the order of the models (i.e. you don't have an int in the model named 'place'), you may want to display the item's title as '#233 PlayerName'. This works well if you're only using ResetItems(Int32, Boolean, Boolean), but if you'll call InsertItems(Int32, Int32, Boolean, Boolean) or RemoveItems(Int32, Int32, Boolean, Boolean), the indices of some views holders are shifted, while they'll maintain their data. In this case, you'll override this method and only update the title from its model
This is an important optimization, because you shouldn't update items that are already updated, especially when fetching them from the web
Namespace: Com.ForbiddenByte.OSA.Core
protected virtual void OnItemIndexChangedDueInsertOrRemove( TItemViewsHolder shiftedViewsHolder, int oldIndex, bool wasInsert, int removeOrInsertIndex )