ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SymbolFactory Class / ConstructGradientFill Method / ConstructGradientFill(CIMColorRamp,GradientFillMethod,Int32) Method
ArcGIS.Core.CIM.CIMColorRamp
ArcGIS.Core.CIM.GradientFillMethod. The default value is ArcGIS.Core.CIM.GradientFillMethod.Buffered
The interval.
Example

In This Topic
    ConstructGradientFill(CIMColorRamp,GradientFillMethod,Int32) Method
    In This Topic
    Constructs a gradient fill using the specififed color ramp.
    Syntax
    Public Overloads Function ConstructGradientFill( _
       ByVal colorRamp As CIMColorRamp, _
       Optional ByVal gradientFillMethod As GradientFillMethod, _
       Optional ByVal interval As Integer _
    ) As CIMFill

    Parameters

    colorRamp
    ArcGIS.Core.CIM.CIMColorRamp
    gradientFillMethod
    ArcGIS.Core.CIM.GradientFillMethod. The default value is ArcGIS.Core.CIM.GradientFillMethod.Buffered
    interval
    The interval.

    Return Value

    Example
    Snippet 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](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/PolygonSymbolTwoColors.png)
    /// </summary>
    /// <returns></returns>
    public static Task<CIMPolygonSymbol> CreateGradientTwoColorsPolygonAsync()
    {
      return QueuedTask.Run<CIMPolygonSymbol>(() =>
      {
        //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
          };
        return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
      });
    
    }
    Snippet Gradient fill using Color ramp
    /// <summary>
    /// Create a polygon symbol using the ConstructGradientFill method. Constructs a gradient fill using the specified color ramp. <br/>
    /// ![PolygonSymbolColorRamp](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/PolygonSymbolColorRamp.png)
    /// </summary>
    /// <returns></returns>
    public static Task<CIMPolygonSymbol> CreateGradientColorRampPolygonAsync()
    {
      return QueuedTask.Run<CIMPolygonSymbol>(() =>
      {
        //outine
        CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(49, 49, 49), 2.0, SimpleLineStyle.Solid);
    
        //gradient fill using a color ramp
        var gradientFill = SymbolFactory.Instance.ConstructGradientFill(GetColorRamp(), GradientFillMethod.Linear);
    
        List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
          {
                    outline,
                    gradientFill
          };
        return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
      });
    
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also