0

我如何将多个图钉添加到 bing 地图控件。在我的应用程序中,我尝试添加一些用户控件(图钉)作为该地图控件的子项。但问题是,当我执行放大和缩小操作时,图钉在地图上移动并错过了位置。这是我用于向地图添加多个图钉的代码:

            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);
                }
4

1 回答 1

3

尝试这个:

            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);
于 2012-10-24T01:49:51.890 回答