Search code examples
windows-phone-7windows-phone-8mapspushpin

The type or namespace pushPin could not be found in Windows Phone 8


When I'm trying to add a pushPin to map I am getting an error "The type or namespace pushPin could not be found in Windows Phone 8". Can anyone tell me what is the reference that I'm missing. I am using default maps by windows phone

Code that I'm using to add pushpin is as below.

MapLayer layer = new MapLayer();
Pushpin pp = new Pushpin();
pp.GeoCoordinate = MyGeoPosition;
MapOverlay overlay1 = new MapOverlay();
overlay1.Content = pp;
overlay1.GeoCoordinate = MyGeoPosition;
layer1.Add(overlay1);
myMap.Layers.Add(layer);

Thanks in Advance !!!


Solution

  • try this

    MapLayer layer = new MapLayer();
    Ellipse ellipse = new Ellipse();
    ellipse.Width = 25;
    ellipse.Height = 25;
    ellipse.Fill = new SolidColorBrush(Color.FromArgb(75, 200, 0, 0));
    MapOverlay overlay1 = new MapOverlay();
    overlay1.Content = ellipse;
    overlay1.GeoCoordinate = MyGeoPosition;
    layer1.Add(overlay1);
    myMap.Layers.Add(layer);
    

    Hope this helps.