ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / CanLookupSymbol Method
Example

In This Topic
    CanLookupSymbol Method
    In This Topic
    Determines whether the layer's renderer type supports symbol lookup. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public bool CanLookupSymbol()
    Public Function CanLookupSymbol() As Boolean

    Return Value

    True if the layer's renderer type supports symbol lookup
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    The following renderers support symbol lookup:
    • CIMSimpleRenderer
    • CIMUniqueValueRenderer
    • CIMClassbreaksRenderer
      • Graduated
      • Unclassed
    • CIMDictionaryRenderer
    • CIMProportionalRenderer

    Refer to LookupSymbol for additional details
    Example
    Lookup Symbol
    //Note: Run within QueuedTask.Run
    //Get the selection
    var selection = featureLayer.GetSelection();
      //Get the first Object ID
      var firstOID = selection.GetObjectIDs().FirstOrDefault();
      //Determine whether the layer's renderer type supports symbol lookup.
      if (featureLayer.CanLookupSymbol())
      {
          //Looks up the symbol for the corresponding feature identified by the object id.
          var symbol = featureLayer.LookupSymbol(firstOID, MapView.Active);
          var jSon = symbol.ToJson(); //Create a JSON encoding of the symbol
          //Do something with symbol
      }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also