Hi Mortein,
Thanks for your answer. I finally managed to use the geometry service to perform the intersection query. Now I am able to select the graphics on the map and it gets selected but still have one step to go as this selects all the graphics on the map. Can you just tell me the way to select the selected graphics at a time. Below is my new code.
void spatialQueryPolygon(Object sender, DrawEventArgs e)
{
GraphicsLayer graphicLayer1 = edmsMap.Layers[selectedProgramTypeName] as GraphicsLayer;
GraphicsLayer graphicLayer = edmsMap.Layers["graphicsLayer"] as GraphicsLayer;
//GraphicCollection _theGraphicsCollection = graphicLayer.Graphics;
geometryService.RelationCompleted += new EventHandler<RelationEventArgs>(geometryService_RelationCompleted);
string sclRelationship = "dim(g1.interior, g2) != null";
geometryService.RelationAsync(graphicLayer1.Graphics.ToList(), graphicLayer1.Graphics.ToList(),
GeometryRelation.esriGeometryRelationRelation, sclRelationship);
}
void geometryService_RelationCompleted(object sender, RelationEventArgs e)
{
string results = "";
for (int i = 0; i < e.Results.Count; i++)
{
results += string.Format("Point {0} is within polygon {1}.\n", e.Results.Graphic1Index,
e.Results.Graphic2Index);
GraphicsLayer graphicLayer1 = edmsMap.Layers[selectedProgramTypeName] as GraphicsLayer;
GraphicCollection graphicCollection = graphicLayer1.Graphics;
foreach (Graphic graphic in graphicCollection)
{
ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol SimpleLineSymbol;
SimpleLineSymbol = (ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol)(LayoutRoot.Resources["DefaultLineSymbol"]);
graphic.Symbol = (ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol)SimpleLineSymbol;
}
}
}
Regards,
Saurabh.