1

我正在尝试使用地图图层填充地图控件,但是每当我尝试将所有图钉添加到地图时,只会显示一个。我检查了这些值是否被添加到地图图层并且它们存在,那么问题是什么。

    private readonly CredentialsProvider _credentialsProvider = new ApplicationIdCredentialsProvider(App.Id);
    private static readonly GeoCoordinate DefaultLocation = new GeoCoordinate(18.091020, -77.377636);
    public List<Pushpin> Pushpins = new List<Pushpin>();

    public map()
    {
        InitializeComponent();

    var layer = new MapLayer();
        var api = new PPSApi.PPSApi();

        api.GetAllPotholes((res) =>
        {
            if (res.StatusCode == HttpStatusCode.OK)
            {
                foreach (var pothole in res.Data.pothole)
                {
                    Pushpin pin = new Pushpin();
                    pin.Location.Latitude = pothole.Latitude;
                    pin.Location.Longitude = pothole.Longitude;
                    layer.AddChild(pin,pin.Location);
                    Debug.WriteLine(pin.Location);

                }
            }

        });
        PotholeMap.Children.Add(layer);

地图截图。

4

0 回答 0