[英]WP8 map overlay out of range error
我有以下问题。 我编写了此功能,以便将某些图像作为图标添加到Windows Phone 8的Silverlight C#应用程序上的地图中。
private void SpecialMapIcons()
{
MapLayer layer = new MapLayer();
List<string[]> SpecialIcons = new List<string[]>();
SpecialIcons.Add(new string[] { "icon0.png", "52.5", "13.5" });
SpecialIcons.Add(new string[] { "icon1.png", "52.4", "13.4" });
for (int i = 0; i < SpecialIcons.Count; i++)
{
string[] Icons = SpecialIcons[i];
MapOverlay overlay = new MapOverlay()
{
GeoCoordinate = new GeoCoordinate(Convert.ToDouble(Icons[1]), Convert.ToDouble(Icons[2])),
Content = new Image
{
Source = new BitmapImage(new Uri("/Assets/icon/" + Icons[0], UriKind.Relative)),
Width = 50,
Height = 50,
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center
}
};
layer.Add(overlay);
}
Map.Layers.Add(layer);
}
在Emulator上,它工作得很好,但是在Device上,我总是在我创建叠加层的行上得到超出范围的异常值,其值为-90到90:
MapOverlay overlay = new MapOverlay()
我不知道为什么会发生这种情况或该值应表示什么。 有没有人暗示如何解决这个问题?
好的,我发现了问题,我不知道为什么,但是模拟器上的silvelight可以使用
Convert.ToDouble()
功能正常但设备无效。 那里:
float.Parse(,System.Globalization.CultureInfo.InvariantCulture)
必须使用功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.