BaconographyWP8.Common.ReorderListBox.DragScroll C# (CSharp) Method

DragScroll() private method

Automatically scrolls for as long as the drag is held within the margin. The speed of the scroll is adjusted based on the depth into the margin.
private DragScroll ( ) : void
return void
        private void DragScroll()
        {
            if (this.dragScrollDelta != 0)
            {
                double scrollRatio = this.scrollViewer.ViewportHeight / this.scrollViewer.RenderSize.Height;
                double adjustedDelta = this.dragScrollDelta * scrollRatio;
                double newOffset = this.scrollViewer.VerticalOffset + adjustedDelta;
                this.scrollViewer.ScrollToVerticalOffset(newOffset);

                this.Dispatcher.BeginInvoke(() => this.DragScroll());

                double dragItemOffset = Canvas.GetTop(this.dragIndicator) +
                    ((TranslateTransform)this.dragIndicator.RenderTransform).Y +
                    this.dragIndicator.Height / 2;
                this.UpdateDropTarget(dragItemOffset, true);
            }
            else
            {
                VisualStateManager.GoToState(this.scrollViewer, ReorderListBox.ScrollViewerNotScrollingVisualState, true);
            }
        }