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/path.

    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

    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

    ShapeStyle.

    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

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

    Opacity

    Gets or sets the transparency level of the diagram elements.

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

    The default value is 1px

    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

    The default value is black

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

    StrokeDashArray

    Gets or sets the pattern of dashes and space to the stroke of the diagram elements.

    Declaration
    public string StrokeDashArray { get; set; }
    Property Value
    Type
    System.String
    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

    The default value is 1px

    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

    ShapeStyle

    Overrides
    DiagramObject.Clone()

    Implements

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