예제 #1
0
        internal void ScrollIndexIntoView(ScrollIntoViewOperation <int> operation)
        {
            var index = operation.RequestedItem;
            var frozenContainersLength = Math.Max(0, this.RowPool.FrozenContainersLength);

            var itemLength     = this.rowLayout.RenderInfo.ValueForIndex(index);
            var offsetToScroll = this.rowLayout.RenderInfo.OffsetFromIndex(index) - itemLength;

            if (DoubleArithmetics.IsLessThan(operation.InitialScrollOffset + frozenContainersLength, offsetToScroll))
            {
                if (index > 0)
                {
                    offsetToScroll -= this.View.ViewportHeight;
                    offsetToScroll += itemLength;
                }
            }
            else if (DoubleArithmetics.IsLessThanOrEqual(offsetToScroll, operation.InitialScrollOffset + frozenContainersLength))
            {
                offsetToScroll -= frozenContainersLength;
            }

            var scrollPosition = new RadPoint(this.PhysicalHorizontalOffset, Math.Max(0, offsetToScroll));

            this.GridView.SetScrollPosition(scrollPosition, true, true);
        }
예제 #2
0
        private void RadListViewItem_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
        {
            var aritmetics = new DoubleArithmetics(1);

            if (!aritmetics.AreClose(e.PreviousSize, e.NewSize) && !this.isReordering)
            {
                this.Owner.UpdateService.RegisterUpdate(new DelegateUpdate <UpdateFlags>(() => this.ListView.contentPanel.InvalidateMeasure()));
                this.needUpdate = false;
            }
        }
예제 #3
0
        internal bool IsColumnIndexInView(ScrollIntoViewOperation <int> operation)
        {
            var column = this.ColumnPool.GetDisplayedElement(operation.RequestedItem);

            if (column == null)
            {
                return(false);
            }

            // Since the headers are not part of the scrollviewer we need to compare their position to the viewport window and omit the scroll offset.
            return(DoubleArithmetics.Ceiling(column.LayoutSlot.X) >= 0 &&
                   DoubleArithmetics.IsLessThanOrEqual(column.LayoutSlot.X + column.layoutSlot.Width, this.View.ViewportWidth));
        }
예제 #4
0
        internal bool IsIndexInView(ScrollIntoViewOperation <int> operation)
        {
            var layoutSlot = this.RowPool.GetPreviousDisplayedLayoutSlot(operation.RequestedItem);

            if (layoutSlot == RadRect.Invalid)
            {
                return(false);
            }

            var frozenContainersLength = Math.Max(0, this.RowPool.FrozenContainersLength);

            return(DoubleArithmetics.IsGreaterThanOrEqual(layoutSlot.Y, this.PhysicalVerticalOffset + frozenContainersLength) &&
                   DoubleArithmetics.IsLessThanOrEqual(layoutSlot.Y + layoutSlot.Height, this.PhysicalVerticalOffset + this.View.ViewportHeight));
        }