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
Post a Comment