/// <summary> /// Scrolls to item with specifid index. /// </summary> /// <param name="index">Index.</param> protected override void ScrollTo(int index) { if (!CanOptimize()) { return; } var first_visible = GetFirstVisibleIndex(true); var last_visible = GetLastVisibleIndex(true); if (first_visible > index) { var item_starts = index * GetItemSize(); SetScrollValue(item_starts); } else if (last_visible < index) { var item_ends = (index + 1) * GetItemSize() - LayoutBridge.GetSpacing() + LayoutBridge.GetMargin() - GetScrollSize(); SetScrollValue(item_ends); } }
/// <summary> /// Gets the item bottom position by index. /// </summary> /// <returns>The item bottom position.</returns> /// <param name="index">Index.</param> public virtual float GetItemPositionBottom(int index) { return(GetItemPosition(index) + GetItemSize() - LayoutBridge.GetSpacing() + LayoutBridge.GetMargin() - GetScrollSize()); }