ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Layer Class / SetExpanded Method
Expands.
Example

In This Topic
    SetExpanded Method
    In This Topic
    Sets whether the layer appears expanded i.e. showing legends on the TOC. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub SetExpanded( _
       ByVal isExpanded As Boolean _
    ) 
    public void SetExpanded( 
       bool isExpanded
    )

    Parameters

    isExpanded
    Expands.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Manipulate the Voxel Layer TOC Group
    {
      //Toggle containers and visibility in the TOC
    
      // Note: call within QueuedTask.Run()
      {
        voxelLayer.SetExpanded(!voxelLayer.IsExpanded);
        voxelLayer.SetVisibility(!voxelLayer.IsVisible);
        voxelLayer.SetIsosurfaceContainerExpanded(!voxelLayer.IsIsosurfaceContainerExpanded);
        voxelLayer.SetIsosurfaceContainerVisibility(!voxelLayer.IsIsosurfaceContainerVisible);
        voxelLayer.SetSliceContainerExpanded(voxelLayer.IsSliceContainerExpanded);
        voxelLayer.SetSliceContainerVisibility(!voxelLayer.IsSliceContainerVisible);
        voxelLayer.SetSectionContainerExpanded(!voxelLayer.IsSectionContainerExpanded);
        voxelLayer.SetSectionContainerVisibility(!voxelLayer.IsSectionContainerVisible);
        voxelLayer.SetLockedSectionContainerExpanded(!voxelLayer.IsLockedSectionContainerExpanded);
        voxelLayer.SetLockedSectionContainerVisibility(!voxelLayer.IsLockedSectionContainerVisible);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also