ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class
Members Example

In This Topic
    MapView Class
    In This Topic
    Represents a view of a map (2D) or a scene (3D).
    Object Model
    MapView ClassMapView ClassViewAnimation ClassCamera ClassMapPoint ClassEnvelope ClassCIMFloorFilterSettings ClassCIMCameraEffect ClassSelectionSet ClassSelectionSet ClassDataSourceMember InterfaceCIMVisualEffect ClassLocatorManager ClassCamera ClassMap ClassRangeExtent ClassMapPoint ClassSelectionSet ClassSelectionSet ClassTimeRange Class
    public class MapView 
    Public Class MapView 

    A project can contain multiple maps, either 2D or 3D, and each defines the collection of layers that make up that map. A map view is simply a view of a map. Map views are the primary interface used to display, navigate, select, identify, and edit data in a 2D or 3D map. The MapView class provides properties and methods to navigate and interact with layers in the map. The map being visualized in the view can be accessed via the Map property.

    There can be multiple map views open at a given time, but there can only be one active map view. The active map view will set the context for the ribbon and many of the dock panes in the application. For example, the map Contents pane will reflect the layers of the active map view's map. The instance of the active map view can be accessed via the static the Active property. The active property will return null if there is no active map view. This is useful when writing commands designed to interact with the active map.

    The map view also provides the context for the selected items in the Contents pane. For example, the GetSelectedLayers method returns the collection of layers that are currently selected in the Contents pane. This context is used to determine which contextual tabs to show, for example, when one or more feature layers are selected, the Feature Layer tab group will display, and the commands will act on the selected feature layers. This is useful when writing commands to work with the selected items in the Contents pane.

    Get the active map's name
    public string GetActiveMapName()
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return null;
      //Return the name of the map currently displayed in the active map view.
      return mapView.Map.Name;
    Inheritance Hierarchy



    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also