in WPF. How to scroll Objects in ScrollViewer by mouse-dragging, like as iPhone?

前端 未结 7 820
轻奢々
轻奢々 2020-12-30 10:59

it\'s done well to scroll by mouse-wheel or scrollbar seed-dragging. but scrolling by mouse-dragging contents on scroll view is not done. How can i implement this action?

7条回答
  •  庸人自扰
    2020-12-30 11:55

    My experience: follow user110777 Changed below code

    private void scrollViewer_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
           scrollMousePoint = e.GetPosition(scrollViewer);
            hOff = scrollViewer.HorizontalOffset;
            scrollViewer.CaptureMouse();
        }
    

提交回复
热议问题