ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / SetViewingModeAsync Method
Example

In This Topic
    SetViewingModeAsync Method
    In This Topic
    Set the perspective of the map view..
    Syntax
    public Task SetViewingModeAsync( 
       MapViewingMode viewingMode
    )
    Public Function SetViewingModeAsync( _
       ByVal viewingMode As MapViewingMode _
    ) As Task

    Parameters

    viewingMode
    Exceptions
    ExceptionDescription
    Map can only be set for 2D views and SceneLocal and SceneGlobal can only be set for 3D views.
    Remarks
    A map view can be used to show maps which display 2D data or scenes which display 3D data. This method can be used to switch between Local and Global for 3D.
    Example
    Set ViewingMode
    public void SetViewingModeToSceneLocal()
    {
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return;
    
      //Check if the view can be set to SceneLocal and if it can set it.
      if (mapView.CanSetViewingMode(ArcGIS.Core.CIM.MapViewingMode.SceneLocal))
        mapView.SetViewingModeAsync(ArcGIS.Core.CIM.MapViewingMode.SceneLocal);
    }
    Set ViewingMode
    public void SetViewingModeToSceneLocal()
    {
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return;
    
      //Check if the view can be set to SceneLocal and if it can set it.
      if (mapView.CanSetViewingMode(ArcGIS.Core.CIM.MapViewingMode.SceneLocal))
        mapView.SetViewingModeAsync(ArcGIS.Core.CIM.MapViewingMode.SceneLocal);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also