In the following code I wanna zoom to selected city. But zoom is unsuccessful.
private void ctxQueryComBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
City selectedCity = ctxQueryComBox.SelectedItem as City;
FeatureLayer layer = Map.Layers["cityFeature"] as FeatureLayer;
if (layer == null || selectedCity ==null)
return;
layer.Where = string.Format("CityId = '{0}'", selectedCity.Id); // query
layer.Visible = true;
layer.Update();
Map.Extent = layer.Geometry.Extent;
cxDatagrid.GraphicsLayer = layer;
}
when I selected the city from the combobox, zoom not working.