private int GetPageIndexBySlotIndex(ScrollSnapBase slotScroll, int itemIndex) { if (itemIndex < 0) { return(0); } int stopAtIndex; var currentSlotIndex = slotScroll.TargetPage % slotScroll._screens; if (currentSlotIndex <= itemIndex) { stopAtIndex = slotScroll.TargetPage - currentSlotIndex + itemIndex; } else { stopAtIndex = slotScroll.TargetPage - currentSlotIndex + slotScroll._screens + itemIndex; } return(stopAtIndex); }