Solved! Go to Solution.
I am having an issue with selecting a feature after zooming to it. If the feature is within the spatial extent before zooming to it then I am able to successfully select it. If the feature I am zooming to is not within the spatial extent and I zoom to it then selecting the feature fails.
I noticed that the feature Layer only contains features in the spatial extent so when I loop through it to find the feature to select, it is only there if it is currently in the spatial extent. I tried to refresh the feature Layer after zooming to it but it doesn't appear to update to the new extent that I zoomed too. Is there a step that I am missing to force the feature layer to update its list of features after the zoom or is there a way to query all the features in a featureLayer.
Thanks for any help
myLayer.Graphics.Add(feature); feature.Selected = true;
var graphic = myLayer.Graphics.FirstOrDefault(g => g.Geometry.Extent.Equals(feature.Geometry.Extent)) if (graphic == null) { graphic = feature; myLayer.Graphics.Add(feature); } graphic.Selected = true;
I am having an issue with selecting a feature after zooming to it. If the feature is within the spatial extent before zooming to it then I am able to successfully select it. If the feature I am zooming to is not within the spatial extent and I zoom to it then selecting the feature fails.
I noticed that the feature Layer only contains features in the spatial extent so when I loop through it to find the feature to select, it is only there if it is currently in the spatial extent. I tried to refresh the feature Layer after zooming to it but it doesn't appear to update to the new extent that I zoomed too. Is there a step that I am missing to force the feature layer to update its list of features after the zoom or is there a way to query all the features in a featureLayer.
Thanks for any help
myLayer.Graphics.Add(feature); feature.Selected = true;
var graphic = myLayer.Graphics.FirstOrDefault(g => g.Geometry.Extent.Equals(feature.Geometry.Extent)) if (graphic == null) { graphic = feature; myLayer.Graphics.Add(feature); } graphic.Selected = true;