gpt4 book ai didi

c# - 从 Bing map 中删除图钉

转载 作者:行者123 更新时间:2023-11-30 15:43:04 26 4
gpt4 key购买 nike

我不太明白为什么这不起作用:(Bing 映射 silverlight 控制 WP7)

在此处添加图钉:

GeoCoordinate location = new GeoCoordinate();
location.Latitude = 51.5;
location.Longitude = 0;
pushpin1.Location = location;
map1.Children.Add(pushpin1);

移除此处的图钉:

map1.Children.Remove(pushpin1);

这不会删除图钉,我做错了什么?

谢谢。

最佳答案

我用下面的代码让它工作:

    private void AddPushpinButton_Click(object sender, RoutedEventArgs e)
{
GeoCoordinate location = new GeoCoordinate() { Latitude = 51.5, Longitude = 0 };
Pushpin pushpin1 = new Pushpin() { Location = location, Tag = "FindMeLater" };
map1.Children.Add(pushpin1);
}

private void RemovePushpinButton_Click(object sender, RoutedEventArgs e)
{
var pushpin = map1.Children.First(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "FindMeLater"));
map1.Children.Remove(pushpin);
}

关于c# - 从 Bing map 中删除图钉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7056048/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com