0
votes

Unable to add pushpins to the map in windows phone 8.1 :

<Maps:MapControl x:Name="RestoMap" MapServiceToken="" Height="550" Margin="0,60,0,0" Width="380">
        <Maps:MapItemsControl x:Name="MapPins">
            <Maps:MapItemsControl.ItemTemplate>
                <DataTemplate>
                    <Maps:MapElement >

                    </Maps:MapElement>
                </DataTemplate>
            </Maps:MapItemsControl.ItemTemplate>
        </Maps:MapItemsControl>
</Maps:MapControl>

Code : the coordinates are retrieved correctly

 foreach (var item in AllResto)
    {
         String id = item.id;
         Double latitude = item.latitude;
         Double longitude = item.longitude;
         AllSavedPins.Add(new Data(id, latitude, longitude));
    }
    MapPins.ItemsSource = this.AllSavedPins;
1

1 Answers

0
votes

You can do::

foreach(var pin in AllSavedPins)
{
    RestoMap.Children.Add(pin);
}