Most of my logic is in C#. I suspect my issue is the relationship of the featurelayer and graphics layer. Here is some of my code:The Query: for (int i = 0; i < theSubLayers.Count(); i++)
{
theLayInfo = (LayerInfo)theSubLayers.GetValue(i);
if (theLayInfo.Name == theActiveLayerName)
{
//Do a query to return all the records for the featuredatagrid
QueryTask theQueryTask = new QueryTask();
theQueryTask.ExecuteCompleted += Query_ExecuteCompleted;
Query theQuery = new Query();
theQuery.ReturnGeometry = true;
theQuery.Where = "1=1";
theQuery.OutSpatialReference = MyMap.SpatialReference;
theQuery.OutFields.Add("*");
theQueryTask.Url = dynamicLayer.Url + "/" + i.ToString();
theQueryTask.ExecuteAsync(theQuery, "initial");
break;
}
}
The Query_ExecuteCompleted: FeatureLayer theFeatureLayer = new FeatureLayer();
FeatureSet theFeatSet = args.FeatureSet;
if (theFeatSet != null && theFeatSet.Features.Count > 0)
{
GraphicsLayer theGraphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
theGraphicsLayer.Graphics.Clear();
foreach (Graphic theGFeature in theFeatSet.Features)
{
theGraphicsLayer.Graphics.Insert(0, theGFeature);
}
featureDataGrid1.GraphicsLayer = theGraphicsLayer;
//Set renderer to the graphics layer
IRenderer theRenderer;
theRenderer = grid1.Resources["SelectRenderer"] as ESRI.ArcGIS.Client.IRenderer;
theGraphicsLayer.Renderer = theRenderer;
}