ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ISymbolFactory Interface / ConstructGradientFill Method / ConstructGradientFill(CIMColor,CIMColor,GradientFillMethod,Int32) Method
ArcGIS.Core.CIM.CIMColor
ArcGIS.Core.CIM.CIMColor
ArcGIS.Core.CIM.GradientFillMethod. The default value is ArcGIS.Core.CIM.GradientFillMethod.Buffered
The interval.
Example

In This Topic
    ConstructGradientFill(CIMColor,CIMColor,GradientFillMethod,Int32) Method
    In This Topic
    Constructs a gradient fill between two colors using the specified gradient fill method.
    Syntax
    Overloads Function ConstructGradientFill( _
       ByVal color1 As CIMColor, _
       ByVal color2 As CIMColor, _
       Optional ByVal gradientFillMethod As GradientFillMethod, _
       Optional ByVal interval As Integer _
    ) As CIMFill

    Parameters

    color1
    ArcGIS.Core.CIM.CIMColor
    color2
    ArcGIS.Core.CIM.CIMColor
    gradientFillMethod
    ArcGIS.Core.CIM.GradientFillMethod. The default value is ArcGIS.Core.CIM.GradientFillMethod.Buffered
    interval
    The interval.

    Return Value

    Example
    Gradient fill between two colors
    /// <summary>
    /// Create a polygon symbol using the ConstructGradientFill method. Constructs a gradient fill between two colors passed to the method. <br/>
    /// ![PolygonSymbolTwoColors](https://ArcGIS.github.io/arcgis-pro-sdk/images/Symbology/PolygonSymbolTwoColors.png)
    /// </summary>
    {
      //Note: Run withing QueuedTask
      //gradient fill between 2 colors
      var gradientFill = SymbolFactory.Instance.ConstructGradientFill(CIMColor.CreateRGBColor(235, 64, 52), CIMColor.NoColor(), GradientFillMethod.Linear);
      List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
        {
                  gradientFill
        };
      CIMPolygonSymbol gradientFillTwoColors = new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
      //To apply the symbol to a polygon feature layer
      //var renderer = theLayer.GetRenderer() as CIMSimpleRenderer;
      //renderer.Symbol = gradientFillTwoColors.MakeSymbolReference();
      //theLayer.SetRenderer(renderer);
    }
    Requirements

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

    ArcGIS Pro version: 3.1 or higher.
    See Also