This project has moved. For the latest updates, please go here.

Map moving while drawing

Feb 18, 2014 at 12:23 AM
I have spent some time learning the mapControl API and I quite like it. I am using the API to draw lines in a map and I am having an issue with the the map moving while I am drawing. I have it set up to use myMap CancelDirectManipulations on the map but the map is still moving. Is something that enables grabbing the map and moving it? To be clear here is what I am doing
 private void drawingPointerHasMoved(object sender, PointerRoutedEventArgs e)
        {
            
            if (drawingPointerIsOn && drawingPressedIsOn) //this checks if they have clicked the button to enable it to draw and if the a finger is touching the screen
            {
                myMap.CancelDirectManipulations(); //this is supposed to make it so I don't move the map around while I am drawing on the map, some times it works and sometimes it doesn't, almost like it is clashing with some other commands. 
                
                
               
                PointerPoint pp = e.GetCurrentPoint(myMap); //gets the location of the mouse pointer or finger touch
                MapControl.Location location = myMap.ViewportPointToLocation(pp.Position); //makes it a location obj
                MapControl.LocationCollection locationCollection = new MapControl.LocationCollection(); 
                loadMap.Polylines.Add(new Points.YouMapPolyline { Locations = locationCollection });
                loadMap.Polylines.ElementAt(locationInLocationsArray).Locations.Add(location);
                
             }
        }
_
Coordinator
Feb 18, 2014 at 11:10 AM
Instead of using class Map you may use its base class, MapBase, which does not provide any input handling. You can then implement any kind of map manipulations on your own.
Feb 20, 2014 at 6:50 PM
Thanks a ton, that was perfect and worked! Thanks for your quick response on my questions.