ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMExpressionInfo Class / Expression Property

In This Topic
    Expression Property (CIMExpressionInfo)
    In This Topic
    Gets or sets the Arcade expression used to evaluate and return the value that a property expects.
    public string Expression {get; set;}
    Public Property Expression As String
    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

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also