ArcGIS Pro 2.9 API Reference Guide
AddElement(GraphicsLayer,MapPoint,String,CIMTextSymbol) Method

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class > AddElement Method : AddElement(GraphicsLayer,MapPoint,String,CIMTextSymbol) Method
The text placement point
The text string
The text symbol. Can be null
Add a ArcGIS.Desktop.Layouts.GraphicElement based on the input point, text, and textsymbol (optional). This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Shared Function AddElement( _
   ByVal graphicsLayer As GraphicsLayer, _
   ByVal point As MapPoint, _
   ByVal text As String, _
   Optional ByVal textSymbol As CIMTextSymbol _
) As GraphicElement

Parameters

graphicsLayer
point
The text placement point
text
The text string
textSymbol
The text symbol. Can be null

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
point cannot be null or empty
Map has reached maximum graphics count limit of 4000 elements. One or more elements cannot be created.
Map has reached maximum graphics size limit of 10 MB. One or more elements cannot be created.
Remarks
The point cannot be null or empty. If text is null an empty string is assigned. If textSymbol is null a default text symbol is assigned.
The map view displaying the graphics layer should be initialized.
The element will be selected after the add.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

GraphicsLayerExtensions Class
GraphicsLayerExtensions Members
Overload List