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
380
prevent zoom on mouse wheel in XamDataChart
posted

I'm using a XamDataChart with a HorizontalZoombar and a VerticalZoombar.

I would like to change the functionality so that when I scroll the mouse wheel, it scrolls vertically rather than zooming in.

How can I do this?

  • 34830
    Offline posted

    Hello Josh,

    In order to prevent the zoom on mouse wheel, I would recommend handling the PreviewMouseWheel event of the XamDataChart and mark it handled (e.Handled = true where ‘e’ is the event arguments).

    As for getting the chart to scroll vertically, I would recommend that you increment or decrement the WindowPositionVertical property of the XamDataChart based on the e.Delta property of the event arguments. This property returns a value between 0 and 1 and represents the part of the XamDataChart that is vertically scrolled to. This value added together with the XamDataChart.ActualWindowRect.Height will also always add up to 1, so it may be a good idea to constrain this if the new WindowPositionVertical + XamDataChart.ActualWindowRect.Height >= 1

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