void QueryTask3_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet != null && featureSet.Features.Count > 0) { SelectedSitesTreeView.Tag = featureSet.ObjectIdFieldName; SelectedSitesTreeView.ItemsSource = featureSet.Features; int count = 0; Graphic newValue = null; foreach (Graphic g in featureSet.Features) { g.Symbol = LayoutRoot.Resources["SelectMarkerSymbol"] as MarkerSymbol; graphicsLayer.Graphics.Add(g); newValue = g; count = count + 1; } SelectedSitesTreeView.Visibility = System.Windows.Visibility.Visible; // If there was only one graphic, change the data grid the value of this graphic/feature. if (count == 1) { RoutedPropertyChangedEventArgs<object> changedGraphics = new RoutedPropertyChangedEventArgs<object>(null, newValue); SelectedSitesTreeView_SelectedItemChanged(sender, changedGraphics); } } else { SelectedSitesTreeView.Visibility = System.Windows.Visibility.Collapsed; MessageBox.Show("No samples found here, please try another location."); } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.