ArcGIS Pro 2.8 API Reference Guide
RemoveElements Method

ArcGIS.Desktop.Mapping Namespace > GraphicsLayerExtensions Class : RemoveElements Method
The graphics layer being extended
The elements being removed
Remove the elements from the GraphicsLayer collection. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public static void RemoveElements( 
   GraphicsLayer graphicsLayer,
   IEnumerable<Element> elements
)
Public Shared Sub RemoveElements( _
   ByVal graphicsLayer As GraphicsLayer, _
   Optional ByVal elements As IEnumerable(Of Element) _
) 

Parameters

graphicsLayer
The graphics layer being extended
elements
The elements being removed
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
If elements is null then all elements are removed.
If a group element is provided in the list of elements to be removed then the group element and all its children will be removed.
If a child of a group element is provided in the list in addition to its parent then the parent takes precedence (i.e. the entire group element is removed and not just that child).
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