/// <summary> /// Handle events when the popup window closes /// </summary> private void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { // Popup window is closed if (!popupWindow.IsOpen) { // Pop-up is closing, so detach PopupInfo.PropertyChanged and MapApplication.Current.SelectedLayerChanged events PopupInfo.PropertyChanged -= PopupInfo_PropertyChanged; MapApplication.Current.SelectedLayerChanged -= Current_SelectedLayerChanged; // If the pop-up is closing and the temporary layer still exists, remove it from the map. if (temporaryLayer != null) { if (MapApplication.Current.SelectedLayer == temporaryLayer) { HideFeatureDataGrid(); } if (map.Layers.Contains(temporaryLayer)) { map.Layers.Remove(temporaryLayer); } temporaryLayer = null; } Grid infoWindowGrid = Utils.FindChildOfType <Grid>(popupWindow, 3); if (infoWindowGrid.Children.Contains(indicator)) { infoWindowGrid.Children.Remove(indicator); // Remove the busy indicator from the pop-up window } if (CloseNoRecordsView.CanExecute(popupWindow)) { CloseNoRecordsView.Execute(popupWindow); } if (GoBack.CanExecute(popupWindow)) { GoBack.Execute(popupWindow); } _popupItemChanged = false; } }