I am having great difficulty adding pushpins to a map that works in a way I like.
First, I tried adding MapItemsControl and binding to it.
<map:MapItemsControl ItemsSource="{Binding Path=Locations}">
<map:MapItemsControl.ItemTemplate>
<DataTemplate>
<controls:NumberedCircle Number="{Binding Path=Number}" map:MapControl.Location="{Binding Path=Point}"/>
</DataTemplate>
</map:MapItemsControl.ItemTemplate>
</map:MapItemsControl>
This works, but looks absolutely terrible when you pan the map; there is a VERY noticeable delay between the map panning and the pushpin icons catching up to the locations where they are supposed to be. If I pan the map back and forth fast enough, I can make a pushpin jump from one side of the street to the other. This happens with just one item in the list, so it's not like the map is being overwhelmed.
Here's a video of the effect: http://youtu.be/9FIvkOf71bg
Next I tried adding MapIcons to the MapElements collection. This was done in a Behavior since I'm using MVVM, but the general idea is
var mapIcon = new MapIcon() { Location = pushpinDrawBehavior.Location};
mapControl.MapElements.Add(mapIcon);
This works great. I pan the map, the MapIcon stays exactly where it should be no matter how fast I pan around. No laggy behavior at all. But -- the MapIcon appears and disappears when you zoom in and out, as explained in the documentation:
The MapIcon is not guaranteed to be shown. It may be hidden when it obscures other elements or labels on the map.
I'm very frustrated because I have two ways to add pushpins to a map, and they both create a horrible user experience for different reasons. So, questions are:
1) Am I missing anything? Is there a way to make XAML elements not lag on pan? Is there a way to make MapIcons always visible?
2) Is there a way to create a custom class that will behave like a MapIcon? It derives from MapElement, but I can't see how the actual rendering of the pushpin is done, or how the layout of the image, title, etc is defined. If I could create my own MapIcon, I could potentially disable the hiding behavior.
Edit: Ran the app on a Nokia 925 and the effect is much less noticeable (the above video is from a 521). It seems keeping the XAML overlays synced with the map is very processor intensive and will be a lot worse on lesser hardware.