Reputation: 2450
How i can add multiple push pins to bing map control. In my application, i tried to add some user control(Push pins) as children of that map control. But the issue is that when i performing zoom -in and zoom-out operation the push pin moves around the map and miss places the position. Here is the code i used for adding multiple push pins to the map :
foreach (var item in PushPinCollection)
{
var pin = new CustomMapPin(Convert.ToInt32(item.BackgroundColorID)) { Name = item.ID.ToString() };
pin.DoubleTapped += PushpinTapped1;
pin.Tapped += PinTapped;
var loc = new Location(Convert.ToDouble(item.Latitude, System.Globalization.CultureInfo.InvariantCulture), Convert.ToDouble(item.Longitude, System.Globalization.CultureInfo.InvariantCulture));
pin.SetValue(MapLayer.PositionProperty, loc);
NoteMap.Children.Add(pin);
}
Upvotes: 0
Views: 2100
Reputation: 31
Try this:
Bing.Maps.Location loc = new Bing.Maps.Location
{
Latitude = latitude,
Longitude = longitude
};
myMap.SetView(loc, 13);
Pushpin pushpin = new Pushpin();
pushpin.Tapped +=pushpin_Tapped;
pushpin.Text = address;
MapLayer.SetPosition(pushpin, loc);
myMap.Children.Add(pushpin);
Upvotes: 3