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

Jun 13, 2013 at 3:42 PM
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?


Jun 13, 2013 at 10:37 PM
It should work exactly the same way in WPF, check the example in the WPF example browser.
Nov 25, 2013 at 8:22 PM
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.


Nov 27, 2013 at 8:49 PM
I think you won't achieve mouse event handling through XAML...
Nov 27, 2013 at 9:02 PM
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.