I have figured out how to select an address (based on the how do I sample). I'll post it here to help others:
First create an in memory query results layer:
private void AddQueryResultLayer()
{
InMemoryFeatureLayer queryResultLayer = new InMemoryFeatureLayer();
queryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(200, GeoColor.SimpleColors.PastelRed)));
queryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red;
queryResultLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay spatialQueryResultOverlay = new LayerOverlay();
spatialQueryResultOverlay.Layers.Add("QueryResultLayer", queryResultLayer);
gisMap.Overlays.Add("QueryResultOverlay", spatialQueryResultOverlay);
}
Then use the layer to highlight a feature - this is one feature based on an id:
private void SelectAddress(int recId)
{
ShapeFileFeatureLayer addressLayer = (ShapeFileFeatureLayer)gisMap.FindFeatureLayer("AddressLayer");
InMemoryFeatureLayer queryResultLayer = (InMemoryFeatureLayer)gisMap.FindFeatureLayer("QueryResultLayer");
addressLayer.Open();
Feature feature = addressLayer.QueryTools.GetFeatureById(recId.ToString(), ReturningColumnsType.NoColumns);
RectangleShape rect = feature.GetBoundingBox();
addressLayer.Close();
queryResultLayer.InternalFeatures.Clear();
queryResultLayer.InternalFeatures.Add(feature.Id, feature);
rect.ScaleUp(150);
gisMap.CurrentExtent = rect;
gisMap.Refresh();
}
I still need to figure out how to allow the user to seelct a feature when I have many layers...
Any ideas?
Cheers
Steve