c# - How to adjust zoom level on windows phone 8.1 map by pushpins -


i working map control in windows phone 8.1(rt) application , have 2 custom push pins on map , 1 in source address , second destination address , want change zoom level according both push pins , means both pins display on screen path current zoom level

 maplocation.zoomlevel = 14; 

i want change zoom level according both location

you can calculate boundaries of multiple pushpins(positions)in winrt using geoboundingbox.trycompute , set map's view these boundaries.

        try         {         geopoint sourcepoint = --source point here--;         geopoint destpoint= --dest point here--;                  //calculate boundries                 var locations = new list<basicgeoposition>();                 locations.add(sourcepoint.position);                 locations.add(destpoint.position);                 var boundries = geoboundingbox.trycompute(locations);                 await smapcontrol.trysetviewboundsasync(boundries, new thickness(100), mapanimationkind.none);         }         catch(exception)         {             // ignored         } 

note second parameter trysetviewboundsasync method margin added around calculated boundaries.


Comments

Popular posts from this blog

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

javascript - Can Piwik report referrer in real time? -