private void PinTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { foreach (UIElement element in layer.Children) { try { if (!(element is InfoBox)) continue; if ((element as InfoBox).Tag == "Popup") (element as InfoBox).Visibility = Visibility.Collapsed; } catch { } } Pushpin pp = sender as Pushpin; try { InfoBoxData ibd = (InfoBoxData)pp.Tag; InfoBox box = new InfoBox(); box.AddData(ibd); layer.Children.Add(box); box.Tag = "Popup"; if (!String.IsNullOrEmpty(ibd.Title) || !String.IsNullOrEmpty(ibd.Description)) MapLayer.SetPosition(box, MapLayer.GetPosition(pp)); else box.Visibility = Visibility.Collapsed; SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested; } catch { } }