I have a method to draw pushpins to a map which works fine, but I need to append a second pushpin to the first layer. I'm guessing this will involve saving the first layer so that it can be manipulated later. Does anyone have any idea how I would go about this as I'm not quite sure how to save a layer?
At present the DrawPushPin method is called twice in the app, so the first time a new layer is created and same for the second time but this is not ideal as I need to append to the first layer not create a new one.
The method is called like this DrawPushPinCurrent(MyGeoPosition, pushPinName);
and below is the draw method.
private void DrawPushPin(GeoCoordinate MyGeoPosition,string pushPinName)
{
MapLayer layer1 = new MapLayer();
Pushpin pushpin1 = new Pushpin();
pushpin1.GeoCoordinate = MyGeoPosition;
pushpin1.Content = pushPinName;
MapOverlay overlay1 = new MapOverlay();
overlay1.Content = pushpin1;
overlay1.GeoCoordinate = MyGeoPosition;
layer1.Add(overlay1);
MyMap.Layers.Add(layer1);
MyMap.Center = MyGeoPosition;
MyMap.ZoomLevel = 15;
}