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); }
internal void ScrollIndexIntoView(ScrollIntoViewOperation <ItemInfo?> operation) { var index = operation.RequestedItem.Value.Slot; var frozenContainersLength = 0; var itemLength = this.layoutController.strategy.Layout.PhysicalLengthForSlot(index); var offsetToScroll = this.layoutController.strategy.Layout.PhysicalOffsetFromSlot(index) - itemLength; if (DoubleArithmetics.IsLessThan(operation.InitialScrollOffset + frozenContainersLength, offsetToScroll)) { if (index > 0) { offsetToScroll -= this.View.Orientation == Orientation.Vertical ? this.View.ViewportHeight : this.View.ViewportWidth; offsetToScroll += itemLength; } } else if (DoubleArithmetics.IsLessThanOrEqual(offsetToScroll, operation.InitialScrollOffset + frozenContainersLength)) { offsetToScroll -= frozenContainersLength; } var scrollPosition = this.View.Orientation == Orientation.Vertical ? new RadPoint(this.View.ScrollOffset, Math.Max(0, offsetToScroll)) : new RadPoint(Math.Max(0, offsetToScroll), this.View.ScrollOffset); this.View.SetScrollPosition(scrollPosition, true, true); }