ArcGIS Pro 2.6 API Reference Guide
SetLocked Method
Example 

ArcGIS.Desktop.Layouts Namespace > Element Class : SetLocked Method
Boolean
Sets the locked state of an element on a page layout. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetLocked( 
   bool isLocked
)
Public 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
//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 10, Windows 8.1, Windows 7

See Also

Reference

Element Class
Element Members