ArcGIS Pro 2.9 API Reference Guide
AddElement(GraphicsLayer,CIMGraphic,Boolean) Method

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class > AddElement Method : AddElement(GraphicsLayer,CIMGraphic,Boolean) Method
The graphic to be added. Cannot be null
True to set the element selected after the add
Add a ArcGIS.Desktop.Layouts.GraphicElement based on the ArcGIS.Core.CIM.CIMGraphic. This method must be called on the MCT.Use QueuedTask.Run.
Syntax
Public Overloads Shared Function AddElement( _
   ByVal graphicsLayer As GraphicsLayer, _
   ByVal cimGraphic As CIMGraphic, _
   ByVal select As Boolean _
) As GraphicElement

Parameters

graphicsLayer
cimGraphic
The graphic to be added. Cannot be null
select
True to set the element selected after the add

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Value cannot be null: cimGraphic
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
A ArcGIS.Desktop.Layouts.GraphicElement is created that contains the cimGraphic. The geometry of the graphic cannot be empty or null. If the symbology is not set then a default symbology is applied.
o ArcGIS.Core.CIM.CIMInkGraphic is not supported
o ArcGIS.Core.CIM.CIMMultiPatchGraphic is not supported
The map view displaying the graphics layer should be initialized.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

GraphicsLayerExtensions Class
GraphicsLayerExtensions Members
Overload List