ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMElement Class / Locked Property
Example

In This Topic
    Locked Property (CIMElement)
    In This Topic
    Gets or sets a value indicating whether the element is locked. Each element in the contents pane has a lock icon. If the icon is shown as locked, you can not select that feature in the layout using the select tool.
    Syntax
    public bool Locked {get; set;}
    Public Property Locked As Boolean
    Example
    Lock an element
    // The Locked property is displayed in the TOC as a lock symbol next
    // to each element.  If locked the element can't be selected in the layout
    // using the graphic selection tools.
    
    //Perform on the worker thread
    QueuedTask.Run(() =>
    {
      // Reference and load the layout associated with the layout item
      Layout layout = layoutItem.GetLayout();
      if (layout != null)
      {
        //Reference an element by name
        Element element = layout.FindElement("MyElement");
        if (element != null)
        {
          // Modify the Locked property via the CIM
          CIMElement CIMElement = element.GetDefinition() as CIMElement;
          CIMElement.Locked = true;
          element.SetDefinition(CIMElement);
        }
      }
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also