Search code examples
c#dictionarypointdynamic-data-display

Make DraggablePoint Unmoveable on chartplotter (Dynamic Data Display) C#


I'm using Microsoft Visual Studio 2010, including reference Dynamic data display. I'm creating DraggablePoint in c# code. The point creating perfect, My problem is how to make the point unmoveable on the map ? I'm tried to search for property unMoveable or Moveable false but there is no something like this. My code :

    // Creating the new DraggablePoint
    globalPoint = new DraggablePoint(new Point(x1,y1));

    // Set the point position
    globalPoint.Position = new Point(x1,y1);

    // Set the point on the map
    plotter.Children.Add(globalPoint);

Thanks for help.


Solution

  • You can register a callback that moves the point back to its initial position when it's been moved.

    Point p = new Point(x1, y1);
    var globalPoint = new DraggablePoint(p);
    
    globalPoint.PositionChanged += (s, e) => 
    { 
        globalPoint.Position = p; 
    };