private void ArcMapItemDeleted(object item) { var featureToRemove = AvailableFeatures.FirstOrDefault(f => f.ESRILayer == item); if (featureToRemove != null && featureToRemove.IsSelected) { featureToRemove.IsSelected = false; PropertyChanged.Notify(() => SelectedFeature); } AvailableFeatures.Remove(featureToRemove); }
/// <summary> /// Returns the field of the OID for the selected feature. However, it is possible that no feature is selected /// or that no OID exists or both. In this the methods returns null. /// </summary> /// <returns></returns> private Field GetOIDFieldFromSelectedFeature() { var selectedFeature = AvailableFeatures.FirstOrDefault(f => f.IsSelected); return(selectedFeature == null ? null : selectedFeature.Fields.FirstOrDefault(f => f.IsOID)); }