ArcGIS Pro 2.7 API Reference Guide
AddElement(GraphicsLayer,Geometry,CIMSymbol) Method

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class > AddElement Method : AddElement(GraphicsLayer,Geometry,CIMSymbol) Method
The geometry to be used for the graphic element
The symbol to be used for the graphic element. Can be null
Add a ArcGIS.Desktop.Layouts.GraphicElement based on the input geometry and symbol (optional). This method must be called on the MCT. Use QueuedTask.Run
Syntax
Public Overloads Shared Function AddElement( _
   ByVal graphicsLayer As GraphicsLayer, _
   ByVal geometry As Geometry, _
   Optional ByVal symbol As CIMSymbol _
) As GraphicElement

Parameters

graphicsLayer
geometry
The geometry to be used for the graphic element
symbol
The symbol to be used for the graphic element. Can be null

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
geometry cannot be null or empty
symbol is not a CIMPointSymbol | CIMLineSymbol | CIMPolygonSymbol
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
Multipatch geometry is not currently supported.
The geometry cannot be empty or null. Providing the wrong symbol type for the given geometry will result in an System.ArgumentException. If symbol is null a default symbol of the correct type will be assigned.
The map view displaying the graphics layer should be initialized.
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GraphicsLayerExtensions Class
GraphicsLayerExtensions Members
Overload List