Hmm I don't think you need to do all that. A simpler approach would be to make use the Attributes property of each graphic. Notice that in that sample, graphicsLayer.Graphics contain the features returned by the query. Feature, in this sample is not only the Geometry but also the Attributes. You can make use of FeatureDataGrid and have it point to the GraphicsLayer that contain the results.
This might be related to what you are trying to achieve: http://forums.arcgis.com/threads/8309-How-to-perform-spatial-query-between-two-services...
private void SpatialQuery(object sender, RoutedEventArgs e) { //make a loop here to do six spatial querys for (int j = 0; j < 2; j++) { //Graphicslayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; //Graphicslayer.ClearGraphics(); //I didn't use the combox QueryTask queryTask = new QueryTask((layers.ElementAt(j) as FeatureLayer).Url); queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted; queryTask.Failed += QueryTask_Failed; // Bind data grid to query results //Binding resultFeaturesBinding = new Binding("LastResult.Features"); //resultFeaturesBinding.Source = queryTask; //QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding); Query query = new ESRI.ArcGIS.Client.Tasks.Query(); // Specify fields to return from query, if it is the first layer, return the TRS field switch (j) { case 0: query.OutFields.AddRange(new string[] { "TRS" }); break; case 1: query.OutFields.AddRange(new string[] { "NAME_CNTY" }); break; } //the polygon is added from points ESRI.ArcGIS.Client.Geometry.Polygon queryGeometry = new ESRI.ArcGIS.Client.Geometry.Polygon(); queryGeometry.Rings.Add(pPointCollection); query.Geometry = queryGeometry; // Return geometry with result features query.ReturnGeometry = true; queryTask.ExecuteAsync(query); } }
private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args) { MessageBox.Show("Query succedded: " + args.FeatureSet); FeatureSet featureSet = args.FeatureSet; if (featureSet == null || featureSet.Features.Count < 1) { MessageBox.Show("No features retured from query"); return; } GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; if (featureSet != null && featureSet.Features.Count > 0) { foreach (Graphic feature in featureSet.Features) { feature.Symbol = LayoutRoot.Resources["ResultsFillSymbol"] as FillSymbol; graphicsLayer.Graphics.Insert(0, feature); } //ResultsDisplay.Visibility = Visibility.Visible; } }