コード例 #1
0
ファイル: ListViewHeight.cs プロジェクト: RockfFestival/Rock
        /// <summary>
        /// Scrolls to item with specifid index.
        /// </summary>
        /// <param name="index">Index.</param>
        public override void ScrollTo(int index)
        {
            if (!CanOptimize())
            {
                return;
            }

            var top    = GetScrollValue();
            var bottom = GetScrollValue() + scrollHeight;

            var item_starts = ItemStartAt(index);

            var item_ends = ItemEndAt(index) + LayoutBridge.GetMargin();

            if (item_starts < top)
            {
                SetScrollValue(item_starts);
            }
            else if (item_ends > bottom)
            {
                SetScrollValue(item_ends - GetScrollSize());
            }
        }
コード例 #2
0
 /// <summary>
 /// Gets the item position bottom.
 /// </summary>
 /// <returns>The item position bottom.</returns>
 /// <param name="index">Index.</param>
 public override float GetItemPositionBottom(int index)
 {
     return(GetItemPosition(index) + DataSource[index].Height - LayoutBridge.GetSpacing() + LayoutBridge.GetMargin() - GetScrollSize());
 }
コード例 #3
0
        /// <summary>
        /// Gets the item position bottom.
        /// </summary>
        /// <returns>The item position bottom.</returns>
        /// <param name="index">Index.</param>
        public override float GetItemPositionBottom(int index)
        {
            var block = Mathf.Min(GetBlockIndex(index) + 1, BlockSizes.Count);

            return(BlockSizes.GetRange(0, block).SumFloat() + (LayoutBridge.GetSpacing() * (block - 1)) + LayoutBridge.GetMargin() - GetScrollSize());
        }