ArcGIS Pro 2.9 API Reference Guide
AddElement(GraphicsLayer,CIMGraphic,IEnumerable<CIMStringMap>) Method

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class > AddElement Method : AddElement(GraphicsLayer,CIMGraphic,IEnumerable<CIMStringMap>) Method
The graphic to be added. Cannot be null
Custom properties or 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

Parameters

graphicsLayer
cimGraphic
The graphic to be added. Cannot be null
customProperties
Custom properties or 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.
The element will be selected after the add. 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.
Custom properties, if provided, must be serializable to string.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

GraphicsLayerExtensions Class
GraphicsLayerExtensions Members
Overload List