I have one combo box (drop down Menu) name PolySels and another combo box (drop down Menu) name PointsSelectedI want my end users to select a Polygon from the PolySels combo box and a Point Layer from the combo box PointsSelected and have my application preform a spatial selection on the points layer. Select all the points within the poly. I think I have everything set up but I'm having trouble finishing my query selection code and I was wonder if some could help. I've checked out other post and just can't seem to figure it out.
private void ExecuteSpatialSelectionButton_Click(object sender, RoutedEventArgs e)
{
GraphicsLayer selectionGraphicslayer = Map.Layers["MySelectionGraphicsLayer"] as GraphicsLayer;
selectionGraphicslayer.ClearGraphics();
//My Point layer that will be queried
QueryTask queryTask = new QueryTask((PointsSelected.SelectedItem as FeatureLayer).Url);
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
queryTask.Failed += QueryTask_Failed;
Query query = new ESRI.ArcGIS.Client.Tasks.Query();
//Specify fields to return from query...all fields
query.OutFields.Add("*");
//Here's where I'm having problems: I can't figure out how to set the second combo box (the polygon selected layer) to a graphic layer or maybe it needs to be a featurelayer??
GraphicsLayer polyGraphicLayer = new GraphicsLayer((PolySels.SelectedItem as GraphicsLayer).Url);
//FeatureLayer polyFeatureLayer = new FeatureLayer((PolySels.SelectedItem as FeatureLayer).Url);
//Here's the second part that is confusing me based on what I do above should I preform my query with the graphiclayer and use the fullextent or with the feature layer and use the geometry??
query.Geometry = polyGraphicLayer.FullExtent;
// query.SpatialRelationship = SpatialRelationship.esriSpatialRelContains;
// query.Geometry = polyFeatureLayer.Geometry;
// Return geometry with result features
query.ReturnGeometry = true;
queryTask.ExecuteAsync(query);
}
Thanks in advance.Nathalie