我试图从地图中删除所有图钉,但没有删除它们(什么都没有发生),任何帮助将不胜感激
private void Remove_all_PushPins_click(object sender, EventArgs e)
{
MessageBoxResult m = MessageBox.Show("All PushPins will be deleted", "Alert", MessageBoxButton.OKCancel);
if (m == MessageBoxResult.OK)
{
foreach (UIElement element in map1.Children)
{
if (element.GetType() == typeof(Pushpin))
{
map1.Children.Remove(element);
}
}
}
}