我有这个错误信息:
可能的统一参考比较;要获得一个值比较,请将左侧转换为字符串
问题 :
((Pushpin)p).Tag == "locationPushpin"));
==============================
双 Dlat = Convert.ToDouble(g_strLat);
双 Dlon = Convert.ToDouble(g_strLon);
this.map1.Center = new GeoCoordinate(Dlat, Dlon);
如果 (this.map1.Children.Count != 0)
{
var pushpin = map1.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));
如果(图钉!= null)
{
this.map1.Children.Remove(图钉);
}
}
图钉位置图钉 = 新图钉();
//---设置图钉的位置---
locationPushpin.Tag = "locationPushpin";
locationPushpin.Location = new GeoCoordinate(Dlat, Dlon);
locationPushpin.Content = 新椭圆()
{
填充 = 新的 SolidColorBrush(Colors.Orange),
//不透明度 = .8,
高度 = 40,
宽度 = 30
};
locationPushpin.Width = 60;
locationPushpin.Height = 100;
this.map1.Center = new GeoCoordinate(Dlat, Dlon);
this.map1.Children.Add(locationPushpin);
this.map1.ZoomLevel = 13;
感谢您的帮助。谢谢