ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / Extent Property
Example

In This Topic
    Extent Property (MapView)
    In This Topic
    Gets the current extent of the view.
    Syntax
    public Envelope Extent {get;}
    Public ReadOnly Property Extent As Envelope
    Remarks
    Use this in combination with ZoomTo(Geometry,Nullable<TimeSpan>,Boolean) to get and set the view's extent.
    Example
    Expand Extent Synchronous
    public Task<bool> ExpandExtentAsync(double dx, double dy)
    {
      return QueuedTask.Run(() =>
      {
        //Get the active map view.
        var mapView = MapView.Active;
        if (mapView == null)
          return false;
    
        //Expand the current extent by the given ratio.
        var extent = mapView.Extent;
        var newExtent = ArcGIS.Core.Geometry.GeometryEngine.Instance.Expand(extent, dx, dy, true);
        return mapView.ZoomTo(newExtent);
      });
    }
    Expand Extent
    public Task<bool> ExpandExtentAsync(double dx, double dy)
    {
      return QueuedTask.Run(() =>
      {
        //Get the active map view.
        var mapView = MapView.Active;
        if (mapView == null)
          return false;
    
        //Expand the current extent by the given ratio.
        var extent = mapView.Extent;
        var newExtent = ArcGIS.Core.Geometry.GeometryEngine.Instance.Expand(extent, dx, dy, true);
        return mapView.ZoomTo(newExtent);
      });
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also