我正在尝试使用地图图层填充地图控件,但每当我尝试将所有图钉添加到地图时,只显示一个图钉。我检查了值是否被添加到地图图层并且它们存在,所以问题是什么。
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);