private void UpdateViewExtentLabels()
{
// Get the current view point for the map view
Viewpoint currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
if (currentViewpoint == null) { return; }
// Get the current map extent (envelope) from the view point
Envelope currentExtent = currentViewpoint.TargetGeometry as Envelope;
// Project the current extent to geographic coordinates (longitude / latitude)
Envelope currentGeoExtent = GeometryEngine.Project(currentExtent, SpatialReferences.Wgs84) as Envelope;
// Fill the app text boxes with min / max longitude (x) and latitude (y) to four decimal places
XMinTextBox.Text = currentGeoExtent.XMin.ToString("0.####");
YMinTextBox.Text = currentGeoExtent.YMin.ToString("0.####");
XMaxTextBox.Text = currentGeoExtent.XMax.ToString("0.####");
YMaxTextBox.Text = currentGeoExtent.YMax.ToString("0.####");
}