UnSelectElements Method (GraphicsLayerExtensions)
Unselect the elements within the GraphicsLayer collection.
This method must be called on the MCT. Use QueuedTask.Run.
Un-Select Graphic elements
var graphicsLayer = MapView.Active.Map.GetLayersAsFlattenedList()
.OfType<ArcGIS.Desktop.Mapping.GraphicsLayer>().FirstOrDefault();
if (graphicsLayer == null)
return;
//unselect the first element in the currently selected elements
var elem = graphicsLayer.GetSelectedElements().FirstOrDefault();
QueuedTask.Run( () => {
if (elem != null)
//Unselect one element
graphicsLayer.UnSelectElement(elem);
//unselect all elements
graphicsLayer.UnSelectElements();
//equivalent to
graphicsLayer.ClearSelection();
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.