ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / CanSetViewingMode Method
Example

In This Topic
    CanSetViewingMode Method
    In This Topic
    Gets a value indicating if the view can be changed to the provided ArcGIS.Core.CIM.MapViewingMode.
    Syntax
    public bool CanSetViewingMode( 
       MapViewingMode viewingMode
    )
    Public Function CanSetViewingMode( _
       ByVal viewingMode As MapViewingMode _
    ) As Boolean

    Parameters

    viewingMode

    Return Value

    True if the map view can be set to the ArcGIS.Core.CIM.MapViewingMode, false if it cannot.
    Remarks
    Use this method to test if SetViewingModeAsync can complete successfully. For a 2D view the only supported viewing mode is Map. For a 3D view SceneLocal and SceneGlobal are valid viewing modes.
    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);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also