/// <summary> /// Zoom or pan to the current feature /// </summary> /// private void ZoomToFeature_Click(object sender, RoutedEventArgs e) { try { //Get the geometry from SiteDetails Geometry g = Geometry.FromJson(((SiteDetails)((Button)sender).DataContext).ZoomExtent); //Get the map ESRI.ArcGIS.Client.Map map = mapWidget.Map; if (g.SpatialReference.WKID != map.SpatialReference.WKID) { //TODO...need to handle this } //If current resolution is close to min resolution pan to the feature, otherwise zoom to if (map.Resolution.ToString("#.000000") == map.MinimumResolution.ToString("#.000000")) { map.PanTo(g); } else { if (g is MapPoint) { map.ZoomToResolution(map.MinimumResolution, (MapPoint)g); } else { map.ZoomTo(g.Extent.Expand(1.23)); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }