menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GradientBrush - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GradientBrush

    Represents a smooth transition from one color to the next while painting the node.

    Inheritance
    System.Object
    DiagramObject
    GradientBrush
    LinearGradientBrush
    RadialGradientBrush
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    DiagramObject.Clone()
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public abstract class GradientBrush : DiagramObject, IDiagramObject, ICloneable
    Remarks

    A GradientBrush is used to fill nodes with a gradient effect in diagrams.

    Inherit from this class to define specific types of gradient brushes such as linear or radial.

    Constructors

    GradientBrush()

    Initializes a new instance of the Gradient.

    Declaration
    protected GradientBrush()

    GradientBrush(GradientBrush)

    Creates a new instance of the GradientBrush from the given Gradient.

    Declaration
    protected GradientBrush(GradientBrush src)
    Parameters
    Type Name Description
    GradientBrush src

    Gradient.

    Properties

    GradientStops

    Gets or sets the collection of gradient stops that define the gradient behavior.

    Declaration
    public DiagramObjectCollection<GradientStop> GradientStops { get; set; }
    Property Value
    Type Description
    DiagramObjectCollection<GradientStop>

    A DiagramObjectCollection<T> representing the collection of gradient stops. Initialized as an empty collection.

    Examples
    Node node = new Node()
    {
        Style = new ShapeStyle()
        {
            Gradient = new LinearGradientBrush()
            {
                // Start point of linear gradient
                X1 = 0,
                Y1 = 0,
                // End point of linear gradient
                X2 = 50,
                Y2 = 50,
                // Sets an array of stop objects
                GradientStops = new DiagramObjectCollection<GradientStop>()
                {
                    new GradientStop(){ Color = "white", Offset = 0},
                    new GradientStop(){ Color = "#6BA5D7", Offset = 100}
                },
            }
        },
    };

    Implements

    IDiagramObject
    System.ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved