Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Mouse scroll zooming chart does not work inside a ScrollViewer
posted

Hi,

I have a XamDataChart inside a MainWindow scroll Viewer and the scrollViewer implements below to scroll the contents with Mouse Scroll.

private void OnPreviewMouseWheel (object sender, MouseWheelEventArgs e)
{
ScrollViewer scrollView = (ScrollViewer) sender;
scrollView.ScrollToVerticalOffset (scrollView.VerticalOffset - e.Delta);
e.Handled = true;
}

The issue is when cursor comes on XamDataChart while Mouse Scroll, I want chart should zoom in/zoom out as it works on Mouse scroll but this is not happening.

When I remove the above code, I can see chartzoom in/zoom out on Mouse scroll, but window contents are not scrolling.

I have set HorizontalZoomable and VerticalZoomable for chart to true.

Any comments?

Thanks,

Preeti

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Preeti,

    I have been investigating this behavior you are reporting, and by marking e.Handled = true in your OnPreviewMouseWheel event handler for your ScrollViewer in this case, you will essentially be preventing the mouse-wheel event from being handled in the XamDataChart. This will effectively prevent the mouse-wheel zoom operations from happening.

    Is there a particular reason that you are handling this PreviewMouseWheel event on the ScrollViewer and marking it handled?

    Please let me know if you have any other questions or concerns on this matter.

Children