VEShape.Draggable Property

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

A Boolean value indicating whether the VEShape icon on the map can be dragged using the mouse.

VEShape.Draggable = value;

The default value of the Draggable property is false.

Pushpins and the icons corresponding to polygons and polylines are can be dragged. However, polygon lines and polyline lines cannot be dragged.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
      <title>Shape Dragging Sample</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src=""></script>

      <script type="text/javascript">
         var map     = null;
         var pushpin   = null;

         function GetMap()
            map = new VEMap('myMap');
            // Create the pushpin
            pushpin = new VEShape(VEShapeType.Pushpin, map.GetCenter());
            // Allow the pushpin to be dragged
            pushpin.Draggable = true;

            // Assign the shape drag event handlers
            pushpin.onstartdrag = StartDragHandler;
            pushpin.ondrag = DragHandler;
            pushpin.onenddrag = EndDragHandler;

            // Show an info box to indicate the pushpin can be dragged.
            pushpin.SetTitle("Drag me!");


         function StartDragHandler(e)
            document.getElementById("txtDragStatus").value = "Pushpin drag has started.";

         function DragHandler(e)
            document.getElementById("txtDragStatus").value = "Pushpin drag is occurring.";

         function EndDragHandler(e)
            document.getElementById("txtDragStatus").value = "Pushpin drag has ended.";

   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="txtDragStatus"/>