menu

Blazor

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

    Show / Hide Table of Contents

    Class ShapeStyle

    Represents the appearance of a shape or path in a diagram.

    Inheritance
    System.Object
    DiagramObject
    ShapeStyle
    TextStyle
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ShapeStyle : DiagramObject, IDiagramObject, ICloneable
    Remarks

    This class is used to define the visual style of diagram elements, including fill color, stroke settings, and opacity.

    Examples
    Node Node = new Node()
    {
     Style = new ShapeStyle()
     {
        Fill = "#6BA5D7",
        StrokeColor = "#6BA5D7",
      },
    };

    Constructors

    ShapeStyle()

    Initializes a new instance of the ShapeStyle.

    Declaration
    public ShapeStyle()

    ShapeStyle(ShapeStyle)

    Creates a new instance of the ShapeStyle from the given ShapeStyle.

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

    The source ShapeStyle to copy settings from.

    Properties

    Fill

    Gets or sets the fill color of the shape or path.

    Declaration
    public string Fill { get; set; }
    Property Value
    Type Description
    System.String

    A System.String representing the fill color. The default value is "white".

    Examples
    Node node = new Node()
    {
        Annotations = new DiagramObjectCollection<ShapeAnnotation>()
        {
            new ShapeAnnotation
            {
                Content = "Node",
                ID = "Annotation",
                Style = new TextStyle()
                {
                    Fill = "Orange",
                }
            }
        },
    };

    Gradient

    Gets or sets the gradient effect of the diagram elements.

    Declaration
    public GradientBrush Gradient { get; set; }
    Property Value
    Type Description
    GradientBrush

    A GradientBrush representing the gradient effect. Initialized as null.

    Examples
    Node node = new Node()
    {
        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 }
                },
            }
        },
    };

    Opacity

    Gets or sets the opacity level of the diagram elements.

    Declaration
    public double Opacity { get; set; }
    Property Value
    Type Description
    System.Double

    A System.Double representing the opacity level. The default value is 1.0.

    Examples
    Node node = new Node()
    {
        Style = new ShapeStyle()
        {
            Opacity = 0.5
        }
    };

    StrokeColor

    Gets or sets the stroke color of the diagram elements.

    Declaration
    public string StrokeColor { get; set; }
    Property Value
    Type Description
    System.String

    A System.String representing the stroke color. The default value is "black".

    Examples
    Node node = new Node()
    {
        Style = new ShapeStyle()
        {
            StrokeColor = "Red",
        }
    };

    StrokeDashArray

    Gets or sets the pattern of dashes and spaces for the stroke of the diagram elements.

    Declaration
    public string StrokeDashArray { get; set; }
    Property Value
    Type Description
    System.String

    A System.String representing the dash pattern. The default value is langword_csharp_empty.

    Examples
    Node node = new Node()
    {
        Style = new ShapeStyle()
        {
            StrokeDashArray = "5,5",
        }
    };

    StrokeWidth

    Gets or sets the stroke width of the diagram elements.

    Declaration
    public double StrokeWidth { get; set; }
    Property Value
    Type Description
    System.Double

    A System.Double representing the stroke width. The default value is 1.0.

    Examples
    Node node = new Node()
    {
        Style = new ShapeStyle()
        {
            StrokeWidth = 10,
        }
    };

    Methods

    Clone()

    Creates a new ShapeStyle that is a copy of the current style.

    Declaration
    public override object Clone()
    Returns
    Type Description
    System.Object

    A new instance of ShapeStyle that is a copy of the current instance.

    Overrides
    DiagramObject.Clone()

    Implements

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