alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class LinearGradientBrush

    Represents the class that provides functionality to paint nodes with a linear color transition using GradientBrush.

    Inheritance
    object
    DiagramObject
    GradientBrush
    LinearGradientBrush
    Implements
    IDiagramObject
    ICloneable
    Inherited Members
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(string, object, object, IDiagramObject)
    GradientBrush.GradientStops
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class LinearGradientBrush : GradientBrush, IDiagramObject, ICloneable
    Remarks

    This brush allows you to specify the start and end points for linear gradients.

    The linear gradients are defined by two points and a collection of GradientStop objects which specify the colors and positions along the gradient.

    Examples
    Node Node = new Node()
    {
        OffsetX = 250,
        OffsetY = 250,
        Width = 100,
        Height = 100,
        Style = new ShapeStyle()
        {
           Gradient = new LinearGradientBrush()
           {
               X1 = 0,
               Y1 = 0,
               X2 = 50,
               Y2 = 50,
               GradientStops = new DiagramObjectCollection<GradientStop>()
               {
                   new GradientStop(){ Color = "white", Offset = 0},
                   new GradientStop(){ Color = "#6BA5D7", Offset = 100}
               },
           }
        },
     };

    Constructors

    LinearGradientBrush()

    Initializes a new instance of the LinearGradientBrush.

    Declaration
    public LinearGradientBrush()

    LinearGradientBrush(LinearGradientBrush)

    Creates a new LinearGradientBrush from the given LinearGradientBrush.

    Declaration
    public LinearGradientBrush(LinearGradientBrush src)
    Parameters
    Type Name Description
    LinearGradientBrush src

    LinearGradient.

    Properties

    X1

    Gets or sets the x-coordinate of the start point of the linear gradient.

    Declaration
    [JsonPropertyName("x1")]
    public double X1 { get; set; }
    Property Value
    Type Description
    double

    A double representing the x-coordinate. Initialized to 0.0.

    Remarks

    The X1 property defines the horizontal start position of the gradient in the brush space.

    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}
               },
           }
        },
     };

    X2

    Gets or sets the x-coordinate of the endpoint of the linear gradient.

    Declaration
    [JsonPropertyName("x2")]
    public double X2 { get; set; }
    Property Value
    Type Description
    double

    A double representing the x-coordinate. Initialized to 50.0.

    Remarks

    The X2 property defines the horizontal end position of the gradient in the brush space.

    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}
               },
           }
        },
     };

    Y1

    Gets or sets the y-coordinate of the start point of the linear gradient.

    Declaration
    [JsonPropertyName("y1")]
    public double Y1 { get; set; }
    Property Value
    Type Description
    double

    A double representing the y-coordinate. Initialized to 0.0.

    Remarks

    The Y1 property defines the vertical start position of the gradient in the brush space.

    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}
               },
           }
        },
     };

    Y2

    Gets or sets the y-coordinate of the endpoint of the linear gradient.

    Declaration
    [JsonPropertyName("y2")]
    public double Y2 { get; set; }
    Property Value
    Type Description
    double

    A double representing the y-coordinate. Initialized to 50.0.

    Remarks

    The Y2 property defines the vertical end position of the gradient in the brush space.

    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}
               },
           }
        },
     };

    Methods

    Clone()

    Creates a new object that is a copy of the current linear gradient.

    Declaration
    public override object Clone()
    Returns
    Type Description
    object

    A new LinearGradientBrush object that is a copy of this instance.

    Overrides
    DiagramObject.Clone()

    Implements

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