Answered by:
[W8.1]How detect zoom change on Map control in Windows 8.1

Question
-
Hi,
I'm developing a Windows Universal App that uses maps, on Windows Phone I have Maps:MapControl that have the ZoomLevelChanged event.
But on Windows 8.1 I must use the Maps:Map control that doesn't own any event to control the zoom change.
I need a way to detect when a user zoom a Map on Windows 8.1.
Anyone know how to detect a zoom change?Thanks in advance for your help,
Stefano.- Edited by Franklin ChenMicrosoft employee Monday, July 20, 2015 12:03 PM Subject
Saturday, July 18, 2015 9:08 AM
Answers
-
Hi Stefano,
Based on MSDN, the MapControl class is only supported on Windows Phone 8.1. It is not supported on Windows 8.1:
Minimum supported client
None supported [Windows Store apps only]
So I’m confused about your description below:
>>I must use the Maps:Map control that doesn't own any event to control the zoom change.
We don't have an official MapControl on Windows Store, please show us what control you used here.
Actually if you want to use maps in Windows Store app, you can use Bing maps, here is how you can do it: Add Bing Maps to a Windows Store app
And to know how zoom changed, you can check the Map class ViewChanged event, then get the ZoomLevel property.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Barry Wang Tuesday, July 28, 2015 10:26 AM
- Marked as answer by Amy PengMicrosoft employee Wednesday, July 29, 2015 9:49 AM
Monday, July 20, 2015 12:27 PM
All replies
-
Hi Stefano,
Based on MSDN, the MapControl class is only supported on Windows Phone 8.1. It is not supported on Windows 8.1:
Minimum supported client
None supported [Windows Store apps only]
So I’m confused about your description below:
>>I must use the Maps:Map control that doesn't own any event to control the zoom change.
We don't have an official MapControl on Windows Store, please show us what control you used here.
Actually if you want to use maps in Windows Store app, you can use Bing maps, here is how you can do it: Add Bing Maps to a Windows Store app
And to know how zoom changed, you can check the Map class ViewChanged event, then get the ZoomLevel property.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Barry Wang Tuesday, July 28, 2015 10:26 AM
- Marked as answer by Amy PengMicrosoft employee Wednesday, July 29, 2015 9:49 AM
Monday, July 20, 2015 12:27 PM -
Yes I use Bing Maps,
this is the solution that I've found://I've created create custom events ZoomChangedEventHandler and CenterChangedEventHandler public event ZoomChangedEventHandler ZoomChanged; public event CenterChangedEventHandler CenterChanged; private Double oldZoomLevel; private Location oldCenter; private void Initialize() { this.oldZoomLevel = MainMap.ZoomLevel; this.oldCenter = MainMap.Center; this.ZoomChanged += MainPage_ZoomChanged; this.CenterChanged += MainPage_CenterChanged; } private void MainMap_ViewChangeEnded(Object sender, ViewChangeEndedEventArgs e) { if (this.oldZoomLevel != this.MainMap.ZoomLevel) { ZoomChangedEventHandler zoomChanged = this.ZoomChanged; if (zoomChanged != null) { zoomChanged(MainMap, new EventArgs()); } this.oldZoomLevel = this.MainMap.ZoomLevel; } if (this.oldCenter != this.MainMap.Center) { CenterChangedEventHandler centerChanged = this.CenterChanged; if (centerChanged != null) { centerChanged(MainMap, new EventArgs()); } this.oldCenter = this.MainMap.Center; } }
- Edited by Stefano Balzarotti Wednesday, July 29, 2015 4:20 PM
Wednesday, July 29, 2015 4:15 PM -
@Stefano
Thanks for sharing. :)
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, July 30, 2015 3:26 AM -
You can use the new Maps API in Windows Phone 8 to develop map-based apps and to incorporate location and search features. This topic introduces the new map control, map modes, and map views.just go to link:https://msdn.microsoft.com/en-us/library/windows/apps/jj207045(v=vs.105).aspxAnd for more topics, visit the Microsoft Virtual Academyhttp://www.microsoftvirtualacademy.com/Tuesday, October 20, 2015 7:19 PM