public void PagerTabStripViewController(PagerTabStripViewController pagerTabStripViewController, int fromIndex, int toIndex, nfloat progressPercentage, bool indexWasChanged) { if (shouldUpdateButtonBarView) { ButtonBarView.MoveFromIndex(fromIndex, toIndex: toIndex, progressPercentage: progressPercentage, pagerScroll: PagerScroll.Yes); if (ChangeCurrentIndexProgressive != null) { var oldCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(new nint(CurrentIndex != fromIndex ? fromIndex : toIndex), 0)) as ButtonBarViewCell; var newCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(new nint(CurrentIndex), 0)) as ButtonBarViewCell; ChangeCurrentIndexProgressive(oldCell, newCell, progressPercentage, indexWasChanged, true); } } }
public void PagerTabStripViewController(PagerTabStripViewController pagerTabStripViewController, int fromIndex, int toIndex) { if (shouldUpdateButtonBarView) { ButtonBarView.MoveToIndex(toIndex, animated: true, swipeDirection: toIndex < fromIndex ? SwipeDirection.Right : SwipeDirection.Left, pagerScroll: PagerScroll.Yes); if (ChangeCurrentIndex != null) { var oldCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(new nint(CurrentIndex != fromIndex ? fromIndex : toIndex), 0)) as ButtonBarViewCell; var newCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(new nint(CurrentIndex), 0)) as ButtonBarViewCell; ChangeCurrentIndex(oldCell, newCell, true); } } }
public void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { if (indexPath.Item != CurrentIndex) { ButtonBarView.MoveToIndex((int)indexPath.Item, true, SwipeDirection.None, PagerScroll.Yes); shouldUpdateButtonBarView = false; var oldCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(new nint(CurrentIndex), 0)) as ButtonBarViewCell; var newCell = ButtonBarView.CellForItem(NSIndexPath.FromItemSection(indexPath.Item, 0)) as ButtonBarViewCell; if (PagerBehaviour.IsProgressiveIndicator) { ChangeCurrentIndexProgressive?.Invoke(oldCell, newCell, 1, true, true); } else { ChangeCurrentIndex?.Invoke(oldCell, newCell, true); } MoveToViewControllerAtIndex((uint)indexPath.Item); } }