<Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <esri:GraphicCollection x:Key="MyGraphicCollection"/> </Grid.Resources> <!-- more code goes here --> <slData:DataGrid x:Name="QueryDetailsDataGrid" ItemsSource="{Binding Source={StaticResource MyGraphicCollection}}" <!-- more code goes here -->
public MainPage() { InitializeComponent(); myGraphics = this.LayoutRoot.Resources["MyGraphicCollection"] as GraphicCollection; } GraphicCollection myGraphics; void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet != null && featureSet.Features.Count > 0) { if (myGraphics != null) { myGraphics.Clear(); foreach (Graphic g in featureSet.Features) myGraphics.Add(g); } } }
<slData:DataGrid x:Name="QueryDetailsDataGrid" ItemsSource="{Binding ElementName=MyMap, Path=Layers[MyGraphicsLayer].Graphics>
graphicsLayer.Graphics.Clear(); foreach(Graphic g in featureSet.Features) { Graphic graphic = new Graphic(){Geometry = g.Geometry}; foreach(var item in g.Attributes) graphic.Attributes.Add(item.Key, item.Value); graphicsLayer.Graphics.Add(graphic); }
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.