SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0
0

Hi!

I’ve created my own modifier to do this and it was working perfectly in a previous version. It allowed dragging annotations and without events. Now it doesn’t catch events from the pan actions, but caches events from annotation editing.

class CustomPointSelectionModifier : SeriesSelectionModifier
{
    /// <inheritdoc />
    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        base.OnModifierMouseUp(e);
        var xcalc = ParentSurface.XAxes.First().GetCurrentCoordinateCalculator();
        var ycalc = ParentSurface.YAxes.First().GetCurrentCoordinateCalculator();

        var poistionPoint = ParentSurface.RootGrid.TranslatePoint(Mouse.GetPosition((IInputElement)ParentSurface), ModifierSurface);
        var point = new Point()
        {
            X = xcalc.GetDataValue(poistionPoint.X),
            Y = ycalc.GetDataValue(poistionPoint.Y),
        };

        ((PlotBaseDescription)DataContext).OnMouseUp(e, point);
    }
}   

It is demonstrated in the attached example

Hot to achive it now?

Thanks.

Version
5.3.0.11954
  • You must to post comments
0
0

Hi Alexander,

The ModifierMouseArgs contains a property called Source, which tells you where the events are coming from.

OnModifierMouseUp should only fire when the mouse is down on the SciChartSurface and not handled by anything else. If anything handles the event (such as a previous modifier) then the event won’t be received, unless ChartModifierBase.ReceiveHandledEvents is true.

Try setting that property to true and inspecting the source of the ModifierMouseArgs. Does it help?

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.