ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / IElement Interface / SetName Method
String
Example Version

SetName Method (IElement)
Sets the name of the element. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
void SetName( 
   string name
)

Parameters

name
String
Exceptions
ExceptionDescription
This method must be called within the lambda passed to QueuedTask.Run.
Remarks
All elements on a layout must have a unique name so they can be easily referenced.
Example
Element_SetName
//Modify an element's name.

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  element.SetName("New Name");
});
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also