[Example("LineSeries and PlotModel MouseDown event")] in WPF?

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

seveland12 wrote at 2013-06-13 16:42:

I would like to allow the user to both drag individual points around and add new points using the mouse in my WPF application. The functionality I need seems to be entirely contained in the WinForms example I referenced in the subject line, but there isn't an obvious analogue for OxyPlot.WPF. Is there currently a way to do this in OxyPlot.WPF?



objo wrote at 2013-06-13 23:37:

It should work exactly the same way in WPF, check the example in the WPF example browser.

mmoosman wrote at 2013-11-25 20:22:

I believe I'm seeing the same problem. It looks to me like the Mouse events (MouseDown etc) are only accessible from the Oxyplot namespace version of the controls and not the controls available from the OxyPlot.WPF namespace.

I have been able to reproduce the handling from the example when building the control via code, but not directly through Xaml.



everytimer wrote at 2013-11-27 20:49:

I think you won't achieve mouse event handling through XAML...

mmoosman wrote at 2013-11-27 21:02:

I was able to work around the issue by using the IsVisibleChanged event on a TrackerControl.

However, fundamentally it seems that the OxyPlot.Wpf versions of the controls have a different inheritance path than the base OxyPlot versions. Specifically, the ScatterSeries control I'm looking at does not have inheritance back to UIPlotElement where the custom OnMouseDown, OnMouseMove, and OnMouseUp events are located. The examples from the source code are creating the controls in code from OxyPlot.Series rather than using the controls from OxyPlot.Wpf which is a point of confusion.