DeleteElements(Func<Element,Boolean>) Method
Deletes an array of elements on a page layout. This method must be called on the MCT. Use QueuedTask.Run.
Layout_DeleteElements
//Delete multiple layout elements.
//Perform on the worker thread
await QueuedTask.Run(() =>
{
layout.DeleteElements(item => item.Name.Contains("Clone"));
});
Delete Layout Elements
//on the QueuedTask
var elementsToRemove = layout.GetSelectedElements();
layout.DeleteElements(elementsToRemove);
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);
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.