Page 1 of 1

Prevent moving a marker

Posted: Thu Apr 29, 2021 5:25 pm
by cchrc
Hi,
Under certain circumstances I would like to prevent the position change of markers in the PositionChanged event handler.
So, in the handler i have something like this

Code: Select all

 private void Marker_PositionChanged(object sender, PositionChangedSeriesEventMarkerEventArgs e) 
 {
        // ....... //
	if (true)
	{
         	e.CancelRendering = true;
                return;
         }
        // ....... //
}
however the CancelRendering do not revert the marker position change.
How can I achieve this?
Thanks.

Re: Prevent moving a marker

Posted: Fri Apr 30, 2021 1:13 pm
by ArctionKestutis
It is probably not obvious from the name, but intention of CancelRendering was to prevent extra rendering cycle when updating other chart properties in event handler. We will look at the issue and decide whatever dragging of Marker should also be canceled.
As for now there is no other way to restore previous position, but to copy position from some cached values.

Re: Prevent moving a marker

Posted: Sat May 01, 2021 11:20 am
by cchrc
Hi,
yep I read that the CancelRendering prop is not for preventing the marker move, however I gave it a try :P
I resolved my problem in this way:

Code: Select all

                if (true)
                {
                    e.Marker.YValue = pointLineSeries.Points[pointIndex].Y;
                }
                else
                {
                    pointLineSeries.Points[pointIndex].Y = e.Marker.YValue;
                }
Thanks,
C.