Skip to content

How to remove “Unable to connect to server.Please try again.” error in Bing Maps control in WP7

August 18, 2011

Before, going to WPUG in Shoreditch today, it was a common dilemma when building Bing Map controls in Windows Phone 7, and that was how to remove the “Unable to connect to server. Please try again” Error which is quite tedious from a users perspective seeing this error message in the middle of the Bing Map control.
Having spoken to a few people on how to remove, you can either look into the WP7 contrib project or you can invoke the ErrorLoading method that’s hooked at the base class of the Bing Map control, and remove the uppermost layer off the Bing Map Control from the RootLayer, as you may or my not know the error is added when the Bing Map control sees there is no connection whatsoever even Edge, although I didn’t know I still got it cached when in the London Tube. I called the class CachedMap as the map should always be cached now. Here’s the code:-

using Microsoft.Maps.MapControl;

namespace Models
{
public partial class CachedMap : Map
{
public CachedMap()
: base()
{
base.LoadingError += (s, e) =>
{
base.RootLayer.Children.RemoveAt(5);
};
}
}
}

About these ads

From → Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: