You just need to create a MapPoint geometry (MyMapPoint) based on the input lat/long values. Then use ZoomTo method of Map Class.
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Map~ZoomTo...
MyMap.ZoomTo( MyMapPoint.Extent)
private void DecimalGo_Click(object sender, RoutedEventArgs e) { string lat = Decimal_lat.Text; //use textbox to get the value string lon = Decimal_lon.Text; MapPoint myMapPoint = new MapPoint(); myMapPoint.X = Convert.ToDouble(lat); myMapPoint.Y = Convert.ToDouble(lon); MyMap.ZoomTo(myMapPoint.Extent); }
double buff = 2500; ESRI.ArcGIS.Client.Geometry.Envelope resultGraphicExtent = resultGraphic.Geometry.Extent; double minX = resultGraphicExtent.XMin; double minY = resultGraphicExtent.YMin; double maxX = resultGraphicExtent.XMax; double maxY = resultGraphicExtent.YMax; ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope( minX - buff, minY - buff, maxX + buff, maxY + buff); MyMap.ZoomTo(displayExtent);
You can't use 'ZoomTo' to zoom to a point (i.e. xmin==xmax and ymin == ymax).
You have to create an envelope centered on this point but having a non nul size.