ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMExpressionInfo Class
Members Example

In This Topic
    CIMExpressionInfo Class
    In This Topic
    Represents the properties required for authoring an Arcade expression.
    Object Model
    CIMExpressionInfo ClassCIMExpressionInfo ClassCIMExpressionInfo Class
    Syntax
    Example
    Modify renderer using Arcade
    var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(f => f.ShapeType == esriGeometryType.esriGeometryPolygon);
    if (lyr == null) return;
    QueuedTask.Run(() =>
    {
      // GetRenderer from Layer (assumes it is a unique value renderer)
      var uvRenderer = lyr.GetRenderer() as CIMUniqueValueRenderer;
      if (uvRenderer == null) return;
      //layer has STATE_NAME field
      //community sample Data\Admin\AdminSample.aprx
      string expression = "if ($view.scale > 21000000) { return $feature.STATE_NAME } else { return 'All' }";
      CIMExpressionInfo updatedExpressionInfo = new CIMExpressionInfo
      {
        Expression = expression,
        Title = "Custom" // can be any string used for UI purpose.
      };
      //set the renderer's expression
      uvRenderer.ValueExpressionInfo = updatedExpressionInfo;
    
      //SetRenderer on Layer
      lyr.SetRenderer(uvRenderer);
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMExpressionInfo

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also