Prevent moving a marker

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
cchrc
Posts: 11
Joined: Mon Oct 19, 2020 10:59 pm

Prevent moving a marker

Post by cchrc » Thu Apr 29, 2021 5:25 pm

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.

ArctionKestutis
Posts: 549
Joined: Mon Mar 14, 2016 9:22 am

Re: Prevent moving a marker

Post by ArctionKestutis » Fri Apr 30, 2021 1:13 pm

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.

cchrc
Posts: 11
Joined: Mon Oct 19, 2020 10:59 pm

Re: Prevent moving a marker

Post by cchrc » Sat May 01, 2021 11:20 am

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.

Post Reply