public static void ClearSelection( GraphicsLayer graphicsLayer )
Public Shared Sub ClearSelection( _ ByVal graphicsLayer As GraphicsLayer _ )
Parameters
- graphicsLayer
public static void ClearSelection( GraphicsLayer graphicsLayer )
Public Shared Sub ClearSelection( _ ByVal graphicsLayer As GraphicsLayer _ )
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
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, Windows 8.1