ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / IElement Interface / SetLocked Method
Boolean
Example

In This Topic
    SetLocked Method (IElement)
    In This Topic
    Sets the locked state of an element on a page layout. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    void SetLocked( 
       bool isLocked
    )
    Sub SetLocked( _
       ByVal isLocked As Boolean _
    ) 

    Parameters

    isLocked
    Boolean
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    Remarks
    A value of true displays the element on the page layout.
    Example
    Element_SetLocked
    //Modify an element's locked state if it isn't already
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      if (!element.IsLocked)
      {
        element.SetLocked(true);
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also