menu

Blazor

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

    Show / Hide Table of Contents

    Class ShapeAnnotation

    Represents a textual annotation that can be displayed over nodes and connectors in a diagram.

    Inheritance
    System.Object
    DiagramObject
    Annotation
    ShapeAnnotation
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    Annotation.AdditionalInfo
    Annotation.Constraints
    Annotation.Content
    Annotation.Height
    Annotation.HorizontalAlignment
    Annotation.Hyperlink
    Annotation.ID
    Annotation.Margin
    Annotation.RotationAngle
    Annotation.Style
    Annotation.UseTemplate
    Annotation.VerticalAlignment
    Annotation.Visibility
    Annotation.Width
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ShapeAnnotation : Annotation, IDiagramObject, ICloneable
    Remarks

    The ShapeAnnotation class provides functionality to add descriptive text to diagram elements with customizable positioning, styling, and content formatting.

    Annotations are positioned relative to their parent node or connector using offset values, and support various text formatting options including font styling, alignment, and wrapping behaviors.

    Examples

    The following example demonstrates how to create a node with a shape annotation:

    Node node = new Node()
    {
        OffsetX = 250,
        OffsetY = 250,
        Width = 100,
        Height = 100,
        // Initialize the annotation collection
        Annotations = new DiagramObjectCollection<ShapeAnnotation>() 
        { 
            new ShapeAnnotation 
            { 
                Content = "Node", 
                Offset = new DiagramPoint() { X = 0, Y = 0 } 
            }
        },
    };

    Constructors

    ShapeAnnotation()

    Initializes a new instance of the ShapeAnnotation.

    Declaration
    public ShapeAnnotation()

    ShapeAnnotation(ShapeAnnotation)

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

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

    ShapeAnnotation

    Properties

    Offset

    Gets or sets the position of the annotation relative to its parent bounds.

    Declaration
    public DiagramPoint Offset { get; set; }
    Property Value
    Type Description
    DiagramPoint

    A DiagramPoint representing the relative position of the annotation within its parent element's bounds. The default value is new DiagramPoint() { X = 0, Y = 0 }.

    Remarks

    The Offset property determines where the annotation appears relative to its parent node or connector. The values are normalized coordinates where (0,0) represents the top-left corner and (1,1) represents the bottom-right corner of the parent bounds.

    Examples

    The following example demonstrates how to position an annotation at different locations:

    Node node = new Node()
    {
        Annotations = new DiagramObjectCollection<ShapeAnnotation>() 
        { 
            new ShapeAnnotation 
            { 
                Content = "Node", 
                Offset = new DiagramPoint() { X = 0, Y = 0 } // Top-left corner
            }
        },
    };

    RotationReference

    Gets or sets a value that indicates whether the annotation rotates along with its parent node or remains fixed relative to the page.

    Declaration
    public AnnotationRotationReference RotationReference { get; set; }
    Property Value
    Type Description
    AnnotationRotationReference

    An AnnotationRotationReference specifying the rotation behavior of the annotation. The default value is Parent.

    Remarks

    The RotationReference property controls how the annotation behaves when its parent node is rotated. When set to Parent, the annotation rotates along with the node, maintaining its relative position and orientation.

    When set to Page, the annotation maintains its absolute orientation relative to the page, regardless of the parent node's rotation angle.

    Examples

    The following example demonstrates how to set an annotation to maintain its page orientation:

    Node node = new Node()
    {
        Annotations = new DiagramObjectCollection<ShapeAnnotation>() 
        { 
            new ShapeAnnotation 
            { 
                Content = "Node",
                ID = "Annotation",
                RotationReference = AnnotationRotationReference.Page,
            }
        },
    };

    Methods

    Clone()

    Creates a new ShapeAnnotation that is a copy of the current annotation.

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

    A new ShapeAnnotation object that is a deep copy of the current instance, containing identical property values and configuration settings.

    Overrides
    Annotation.Clone()

    Implements

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