public void LockSection( SectionDefinition sectionDef )
Public Sub LockSection( _ ByVal sectionDef As SectionDefinition _ )
Parameters
- sectionDef
- The definition of the section to lock
public void LockSection( SectionDefinition sectionDef )
Public Sub LockSection( _ ByVal sectionDef As SectionDefinition _ )
| Exception | Description | 
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run | 
| System.ArgumentNullException | Section is null | 
| System.ArgumentException | Section not found in the collection of sections | 
| System.InvalidOperationException | Section cannot be locked | 
      //var voxelLayer = ... ;
      //Must be on the 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.Active.GetSelectedSections().FirstOrDefault();
      if (section == null)
{
          //At 2.x - section = voxelLayer.GetSections().FirstOrDefault();
          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);
	Target Platforms: Windows 11, Windows 10, Windows 8.1