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

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class > AddElement Method : AddElement(GraphicsLayer,CIMGraphic) Method
The graphic to be added. Cannot be null
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 _
) As GraphicElement

Parameters

graphicsLayer
cimGraphic
The graphic to be added. Cannot be null

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.CIMMultipointGraphic is not supported
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 10, Windows 8.1

See Also

Reference

GraphicsLayerExtensions Class
GraphicsLayerExtensions Members
Overload List