Return Value
True if the layer's renderer type supports symbol lookup
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//feature layer from the active map
var lookupMapView = MapView.Active;
var featureLayerLookUp = lookupMapView.Map.GetLayersAsFlattenedList()
.OfType<FeatureLayer>()
.FirstOrDefault();
await QueuedTask.Run(() =>
{
//Get the selection
var selection = featureLayerLookUp.GetSelection();
//Get the first Object ID
var firstOID = selection.GetObjectIDs().FirstOrDefault();
//Determine whether the layer's renderer type supports symbol lookup.
if (featureLayerLookUp.CanLookupSymbol())
{
//Looks up the symbol for the corresponding feature identified by the object id.
var lookupSymbol = featureLayerLookUp.LookupSymbol(firstOID, lookupMapView);
var jSon = lookupSymbol.ToJson(); //Create a JSON encoding of the symbol
//Do something with symbol
}
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)