Asked by:

Stop Map control to download data

Question

I have a page with a Map Control. User can access this page through a previous "menu" page, then he can go back to it by pressing the back arrow... Classic.

There is a problem regarding the maps data transferred to the Control: if the user taps on the back arrow, it must wait a certain amount of seconds before continue, probably because the Map must finish to download some data.

I'm pretty sure of this because I've tried under two types of wireless connection:

- when using a fast connection, like Wi-Fi, this amount of time is imperceptible.
- when using cellular network, the time may vary evenup to 10 seconds!

Hence, how can I stop the map to download data inside the OnNavigatedFrom method? I see the property
Map.IsDownloading but it's only a control flag. Any ideas?

NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces.

I can't implement a "delayed loading" of the Map because it is the principal element of the Page... The user must see it right after the Page load.

There are times in which the user opens the Page, the Map starts fetching data from the network, but after 3-4 seconds the user wants to return back to the previous page. Here, the Map data are not totally downloaded and the user must
wait.

NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces.

If this is from the Bing Maps Map control, I have seen this issue as well with no solution. It seems to happen when the map tiles should be updating, but there is no reliable network connection even though the phone believes one exists. (Cellular
data mode enabled with a bad network connection, for example.) Disabling the Map control would only disable the user's access to the map control and not the downloads behind. In my case, I could wait nearly 30 seconds to leave the page with the
map control. I started a thread on this issue probably around a year ago and found no solution, but I had more details on what was happening and, I believe, some sample code.