Hi Charles,I think it might be an idea to first alter the foreach in ExecutedComplete to add the result to a graphics layer. This seems to be the easiest method to use and the graphics will still have attributes that you can manipulate or display.So you'll have something like:
foreach (var feature in e.FeatureSet)
{
// Add graphics to a GraphicsLayer you have already created
// e.g. GraphicsLayer graphicsLayer = new GraphicsLayer();
graphicsLayer.Graphics.Add(feature);
}
// Add layer to map
map.Layers.Add(graphicsLayer);
Then you can implement ZoomTo:
// Zoom to selected features (define expand percentage)
Envelope selectedFeatureExtent = graphicsLayer.FullExtent.Extent;
double expandPercentage = 30;
double widthExpand = selectedFeatureExtent.Width * (expandPercentage / 100);
double heightExpand = selectedFeatureExtent.Height * (expandPercentage / 100);
ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
selectedFeatureExtent.XMin - (widthExpand / 2),
selectedFeatureExtent.YMin - (heightExpand / 2),
selectedFeatureExtent.XMax + (widthExpand / 2),
selectedFeatureExtent.YMax + (heightExpand / 2));
map.ZoomTo(displayExtent);
As I said, this is pretty simple and you may have to take a different approach if your workflow is complicated.