Forum Cross Platform with Xamarin

Map Pins Not adding in loop

I've been working on a cross platform project that needs to display multiple Map Pins. I've already implemented google/apple maps, and gps for each platform and have my map being displayed with no errors. My issue is that I'm attempting to loop over a list of positions to add and it is only adding the Pin at Position 0.
Code:
Loop:
for (int i = 0; I <Users.Count;i++){
MapView.Pins.Add(Account.Users[i].MakePin());
}

User.MakePin():
public Pin MakePin(){
Pin P = new Pin();
P.Label = Username;
Position Pos = new Position(Location.Latitude, Location.Longitude);
P.Position = Pos;
return P;
}

During debugging I've found that I can add more pins outside of a loop, The User's location is valid and different from the other users and that making the list count down instead of up still causes the pin at position 0 to be the one to appear.

Answers

  • GanigumoGanigumo Member

    Through continued testing I've discovered that the Pins are being added to MapView.Pins corrections, they just won't appear on the map.

  • infotoniinfotoni Member ✭✭
    edited July 2018

    Is it possible your location is double with , or . ?? I had same problem and was because in english language , comma are not allow and . not allow in spanish mobile.

Sign In or Register to comment.