ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / VoxelLayer Class / SetLockedSectionContainerExpanded Method
Toggle expanded.
Example

In This Topic
    SetLockedSectionContainerExpanded Method
    In This Topic
    Sets the locked section container expanded or collapsed. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetLockedSectionContainerExpanded( 
       bool isExpanded
    )
    Public Sub SetLockedSectionContainerExpanded( _
       ByVal isExpanded As Boolean _
    ) 

    Parameters

    isExpanded
    Toggle expanded.
    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
    
      await 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);
      });
    }
    Get the Current Collection of Locked Sections
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        var locked_sections = voxelLayer.GetLockedSections();
      });
    }
    Lock a Section/Create a Locked Section
    {
      var mapView = MapView.Active;
    
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        //Use the SelectedVariableProfile to get the sections
        //via its associated volume
        var volume = voxelLayer.SelectedVariableProfile.Volume;
    
        //get the selected section
        var section = mapView.GetSelectedSections().FirstOrDefault();
        if (section == null)
        {
          section = volume.GetSections().FirstOrDefault();
        }
    
        if (section == null)
        {
          return;
        }
    
        //Lock the section (Creates a locked section, deletes
        //the section)
        //if (voxelLayer.CanLockSection(section))
        //	voxelLayer.LockSection(section);
        if (volume.CanLockSection(section))
        {
          volume.LockSection(section);
        }
      });
    }
    Update Locked Section Visibility
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        var locked_sections = voxelLayer.GetLockedSections().Where(ls => !ls.IsVisible);
    
        //Make them visible
        foreach (var locked_section in locked_sections)
        {
          locked_section.IsVisible = true;
          //apply change
          voxelLayer.UpdateSection(locked_section);
        }
      });
    }
    Unlock a Locked Section
    {
      var mapView = MapView.Active;
    
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetSectionContainerExpanded(true);
        voxelLayer.SetSectionContainerVisibility(true);
        voxelLayer.SetLockedSectionContainerExpanded(true);
    
        //get the selected locked section
        var locked_section = mapView.GetSelectedLockedSections().FirstOrDefault();
        if (locked_section == null)
        {
          locked_section = voxelLayer.GetLockedSections().FirstOrDefault();
        }
    
        if (locked_section == null)
        {
          return;
        }
    
        //Unlock the locked section (Deletes the locked section, creates
        //a section)
        if (voxelLayer.CanUnlockSection(locked_section))
        {
          voxelLayer.UnlockSection(locked_section);
        }
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also