How to remove “Unable to connect to server.Please try again.” error in Bing Maps control in WP7
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);
};
}
}
}
Trackbacks & Pingbacks