Attaching handler to mousewheel event

Oystein Bjorke 4 years ago 0
This discussion was imported from CodePlex

Tech_Junkie wrote at 2012-05-14 16:30:

Hi all,

objo, good work, I love the ease with which I can plot my data with this package!

 

One thing am wondering about still is if it is possible to attach a handler to the use of the mousewheel. In my application I am already using the clicks and movement of the mouse, but the scrolling of a plot I would also like to use.

I've looked through the source and there you obviously use it, but I cannot find out how (if possible) I can hook into these events.

Do you have a tip where I should look? (or how to attach my handler?)

thanks in advance!


objo wrote at 2012-05-14 20:57:

The mouse wheel is used to zoom, so I did not include this in the plot model's events.

But for WPF/SL you can handle the mouse wheel routed event on the Plot control, I suggest using the PreviewMouseWheel event:

http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewmousewheel.aspx


Tech_Junkie wrote at 2012-05-15 09:20:

Exactly the Zoom is what I also want to trigger on, to check the boundaries of one graph and update them on another too. (though I now realize that binding to the AxisChanged event will also work, as mentioned in http://oxyplot.codeplex.com/discussions/352003)

Thanks for the quick response!

CodePlex