0

On my OxyPlot I have a DelegatePlotCommand bound to the PlotController.MouseDown event:

        var commandLeft = new DelegatePlotCommand<OxyMouseDownEventArgs>((v, c, a) =>
        {
            a.Handled = true;
            if (v.ActualModel.Series.Count > 0)
            {
                var series = v.ActualModel.Series[0] as LineSeries;
                var point = series.InverseTransform(a.Position);
                if (PltModel.Annotations.Count > 0 && PltModel.Annotations[0] is LineAnnotation)
                {
                    var lineAnnotation = PltModel.Annotations[0] as LineAnnotation;
                    lineAnnotation.Y = point.Y;
                    lineAnnotation.Text = point.Y.ToString("G3");
                    PltModel.InvalidatePlot(true);
                    guide1Position = point.Y;
                    GuideDifference = (guide1Position - guide2Position).ToString("G3");
                }
            }
        });
        PlotController.BindMouseDown(OxyMouseButton.Left, commandLeft);

The event does not fire when I click on a line series. It works fine outside of the line series. Any suggestions?

laserman
  • 233
  • 2
  • 10

2 Answers2

0

Have you tried to bind the delegate to the LineSeries itself? I am not sure, how PlotController works, but the LineSeries has its own MouseDown event.

G. B.
  • 528
  • 2
  • 15
  • Thanks, I have done that - it still doesn’t work. I have also tried to bind a similar delegate to the plotmodel (also has a mouse down event) - nothing works. – laserman Aug 25 '18 at 16:03
0

I downloaded OxyPlot.Core version="2.0.0-unstable1035" targetFramework="net452" and OxyPlot.Wpf version="2.0.0-unstable1035" targetFramework="net452"

  • it solved the issue. I will look through the change log and find where it was fixed and post it here.
laserman
  • 233
  • 2
  • 10
  • Maybe it was this issue that was fixed. Fix for #382: OxyMouseEvents not caught due to InvalidatePlot() – laserman Aug 25 '18 at 17:00