ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / DeleteElement Method
Element
Example

In This Topic
    DeleteElement Method (Layout)
    In This Topic
    Deletes an element on a page layout. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void DeleteElement( 
       Element element
    )
    Public Sub DeleteElement( _
       ByVal element As Element _
    ) 

    Parameters

    element
    Element
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    Example
    Layout_DeleteElement
    //Delete a single layout element.
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      layout.DeleteElement(elm);
    });
    Delete an element or elements on a layout
    //Delete an element or elements on a layout.
    
    //Perform on the worker thread
    QueuedTask.Run(() =>
    {
      //Delete a specific element on a layout
      aLayout.DeleteElement(elm);
     
      //Or delete a group of elements using a filter
      aLayout.DeleteElements(item => item.Name.Contains("Clone"));
    
      //Or delete all elements on a layout
      aLayout.DeleteElements(item => true);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also