This project has moved and is read-only. For the latest updates, please go here.

How show many pushpins on map?

Feb 14, 2015 at 5:37 PM
Thanks for your work. I need show many pushpins on map, but perfomans is low. I write universal app for wp. I added all pushpins to map and change visible elements:
private void map_ViewportChanged(object sender, EventArgs e)
    foreach (var child in pushpins)
        if (map.ZoomLevel <= 15)
              child.Visibility = Visibility.Collapsed;
          child.Visibility = Visibility.Visible;
Feb 14, 2015 at 5:46 PM
Edited Feb 19, 2015 at 12:12 PM
Windows Phone isn't the most powerful platform. You can't expect to have hundreds of pushpins drawn and perhaps moved simultaneously. You should design your app so that it displays only a limited number of pushpins at a time.
Feb 14, 2015 at 6:12 PM
I thought about this. Can I get bound of view or somthing like that to show only elements that in current view?
Feb 14, 2015 at 7:27 PM
Edited Feb 14, 2015 at 7:27 PM
Sure, just get the viewport corners by MapBase.ViewportPointToLocation:
var northWest = map.ViewportPointToLocation(
    new Point(0, 0));
var southEast = map.ViewportPointToLocation(
    new Point(map.ActualWidth, map.ActualHeight));
Marked as answer by xtergs on 2/14/2015 at 12:22 PM
Apr 21, 2015 at 12:38 PM
xtergs - I had hit the same issue with my application.

However I actually found a bottlenect, why the map is so slow on Windows Phone. Take a look in my clone, while pull request is approved.
The problem is that phone hasn't have anough power to process all the locations of MapItems in expected time. That's why I introduced a new property of the Map DelayedLayoutTime="00:00:00.30", which will cause to update the locations no more than 3 times per second. This greatly improves the UX.
Of course, if you set zeros, this feature will be disabled and control will work in original way.