Search Results

Search found 1 results on 1 pages for 'garegin'.

Page 1/1 | 1 

  • WPF Drag-to-scroll doesn't work correctly.

    - by Garegin
    Hi all, I am tying to realize a drag-to-scroll functionality in my application and have problems on my way. Can anybody help me? I have a ScrollViewer and inside it an ItemsControl and within ItemsTemplate I have a UserControl. I want to drag that UserControl within ItemsControl. I want the ScrollViewer to scroll down, when I am dragging to the boundaries of the ItemsControl. protected override void OnPreviewMouseMove(System.Windows.Input.MouseEventArgs e) { if (this.IsMouseCaptured) { // Get the new mouse position. Point mouseDragCurrentPoint = e.GetPosition(this); if (Math.Abs(mouseDragCurrentPoint.Y - this.ActualHeight) <= 50) { this._scrollStartOffset.Y += 5; _containingScrollViewer.ScrollToVerticalOffset(this._scrollStartOffset.Y); } if (mouseDragCurrentPoint.Y <= 50) { this._scrollStartOffset.Y -= 5; _containingScrollViewer.ScrollToVerticalOffset(this._scrollStartOffset.Y); } } base.OnPreviewMouseMove(e); } When i start dragging by calling DragDrop.DoDragDrop() scrolling don't happens. But when i disable dragging, the ScrollViewer scrolls down dependong on mouse position. Maybe there's something that i don't take into accont about dragging and Capturing the mouse? Thanks for attention. Garegin

    Read the article

1