ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMGradientFill Class
Members Example

In This Topic
    CIMGradientFill Class
    In This Topic
    Represents a gradient fill which fills polygonal geometry with a specified color scheme.
    Object Model
    CIMGradientFill ClassCIMGradientFill ClassCIMColorRamp ClassCIMGradientFill Class
    Syntax
    Example
    Gradient color fill using CIMGradientFill
    /// <summary>
    /// Create a polygon symbol with a gradient color fill. <br/>
    /// ![PolygonSymbolGradientColor](https://ArcGIS.github.io/arcgis-pro-sdk/images/Symbology/polygon-gradient-color.png)
    /// 1. Create a solid colored stroke with 50% transparency
    /// 1. Create a fill using gradient colors red through green
    /// 1. Apply both the stroke and fill as a symbol layer array to the new PolygonSymbol
    /// </summary>
    {
      //Note: Run withing QueuedTask
      var trans = 50.0;//semi transparent
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(0, 0, 0, trans), 2.0, SimpleLineStyle.Solid);
      //Mimic cross hatch
      CIMFill solidColorHatch =
             new CIMGradientFill()
             {
               ColorRamp = ColorFactory.Instance.ConstructColorRamp(ColorRampAlgorithm.LinearContinuous,
                                    ColorFactory.Instance.RedRGB, ColorFactory.Instance.GreenRGB)
             };
      List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
        {
                  outline,
                  solidColorHatch
        };
    
      CIMPolygonSymbol gradientColorFillPolygon = new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
      //To apply the symbol to a polygon feature layer
      //var renderer = theLayer.GetRenderer() as CIMSimpleRenderer;
      //renderer.Symbol = gradientColorFillPolygon.MakeSymbolReference();
      //theLayer.SetRenderer(renderer);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMSymbolLayer
             ArcGIS.Core.CIM.CIMFill
                ArcGIS.Core.CIM.CIMGradientFill

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also