ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / CurrentMapTOCContent Property
Example

In This Topic
    CurrentMapTOCContent Property
    In This Topic
    Gets the current active TOC content type for the map view.
    Syntax
    public MapTOCContentType CurrentMapTOCContent {get;}
    Public ReadOnly Property CurrentMapTOCContent As MapTOCContentType
    Remarks
    If there is no current active TOC content or the current content type is not one of the MapTOCContentType types, then MapTOCContentType.Unknown is returned (for example, the active map is in a layout map frame but has not been activated and the layout TOC is being displayed). Note: As link charts use a map TOC, CurrentMapTOCContentType can also be used when a link chart is the active "map" view
    Example
    Get the Active Map TOC content type
    //Get the current active TOC content type for the map view 
    var mapTOCContentType = MapView.Active.CurrentMapTOCContent;
    
    Set the Active Map TOC content type
          //Get the current active TOC content type for the map view 
          var mapTOCContentType = (int)MapView.Active.CurrentMapTOCContent;
    //increment to the next tab whatever it is
    mapTOCContentType++;
    //Can we set this type on the TOC?
          if (MapView.Active.CanSetMapTOCContent((MapTOCContentType)mapTOCContentType))
      //Set it - must be on the UI! - No QueuedTask
              MapView.Active.SetMapTOCContentAsync((MapTOCContentType)mapTOCContentType);
    else
    {
              mapTOCContentType = (int)MapTOCContentType.DrawingOrder;
              //Set it - must be on the UI! - No QueuedTask
              MapView.Active.SetMapTOCContentAsync((MapTOCContentType)mapTOCContentType);
          }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also