HI, I have a method which returns a feature layer and zooms to it on the map..but when the feature layer count is 1 the map does not zoom to the feature.... //zoom to featurelayer
void featureLayer_UpdateCompleted(object sender, EventArgs e)
{
FeatureLayer projFeatureLayer = (FeatureLayer)sender;
SetLegend();
if (projFeatureLayer.FullExtent != null)
{
double projectXMin = projFeatureLayer.FullExtent.XMin;
double projectXMax = projFeatureLayer.FullExtent.XMax;
double projectYMin = projFeatureLayer.FullExtent.YMin;
double projectYMax = projFeatureLayer.FullExtent.YMax;
double coordOffset = .01;
//Envelope cannot be a single point?
if (projectXMin == projectXMax && projectYMin == projectYMax)
{
projectXMax = projectXMax + coordOffset;
projectXMin = projectXMin - coordOffset;
}
Envelope projectEnvelope = new Envelope(projectXMin, projectYMin, projectXMax, projectYMax);
mainPage.map.ZoomTo(projectEnvelope);
}
else
{
mainPage.lblcustomStatusBar.Content = "Feature not found";
mainPage.lblcustomStatusBar.Foreground = new SolidColorBrush(Colors.Red);
mainPage.panelCustomLegend.Visibility = System.Windows.Visibility.Collapsed;
}
}
Please do guide...