Class UmlClassAttribute
Represents an attribute in a UML class.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.Diagram.dll
Syntax
public class UmlClassAttribute : UmlTypedElement, IDiagramObject, ICloneable
Remarks
This class extends UmlTypedElement and adds support for visibility scope, separator rows, and custom styling through SeparatorStyle.
An attribute defines a named structural feature with optional type, visibility scope, and rendering style. It can also represent a separator row for visual grouping.
Examples
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
nodes.Add(new Node()
{
ID = "classNode",
OffsetX = 250,
OffsetY = 250,
Width = 200,
Height = 200,
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Person",
Attributes = new DiagramObjectCollection<UmlClassAttribute>()
{
new UmlClassAttribute()
{
Name = "Id",
Type = "int",
Scope = UmlScope.Public
},
new UmlClassAttribute()
{
Name = "Name",
Type = "string",
Scope = UmlScope.Private
},
new UmlClassAttribute()
{
IsSeparator = true
},
new UmlClassAttribute()
{
Name = "Age",
Type = "int",
Scope = UmlScope.Protected
}
}
}
}
});
Constructors
UmlClassAttribute()
Creates a new instance of the UmlClassAttribute.
Declaration
public UmlClassAttribute()
UmlClassAttribute(UmlClassAttribute)
Creates a new instance of the UmlClassAttribute.
Declaration
public UmlClassAttribute(UmlClassAttribute src)
Parameters
| Type | Name | Description |
|---|---|---|
| UmlClassAttribute | src | Source instance |
Properties
IsSeparator
Gets or sets a value indicating whether this entry is rendered as a separator line instead of a standard attribute row.
Declaration
[JsonPropertyName("isSeparator")]
public bool IsSeparator { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | bool indicating whether this entry is a separator. The default value is |
Remarks
When this property is set to true, the attribute is displayed as a horizontal
separator line instead of a standard attribute row.
This is useful for visually grouping related attributes in a UML class.
Examples
This example demonstrates adding a separator between attributes:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Product",
Attributes = new DiagramObjectCollection<UmlClassAttribute>()
{
new UmlClassAttribute() { Name = "Name", Type = "string" },
new UmlClassAttribute() { IsSeparator = true },
new UmlClassAttribute() { Name = "Price", Type = "double" }
}
}
}
});
Scope
Gets or sets the visibility scope of the attribute.
Declaration
[JsonPropertyName("scope")]
public UmlScope Scope { get; set; }
Property Value
| Type | Description |
|---|---|
| UmlScope | A UmlScope representing the access level. The default value is |
Remarks
Determines the visibility scope and the corresponding prefix symbol displayed:
Public (+)Protected (#)Private (-)Package (~)
Examples
This example demonstrates setting different scopes for class attributes:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Employee",
Attributes = new DiagramObjectCollection<UmlClassAttribute>()
{
new UmlClassAttribute() { Name = "Id", Type = "int", Scope = UmlScope.Public },
new UmlClassAttribute() { Name = "Salary", Type = "double", Scope = UmlScope.Private }
}
}
}
});
SeparatorStyle
Gets or sets the visual style applied when rendering the entry as a separator line.
Declaration
[JsonPropertyName("separatorStyle")]
public ShapeStyle SeparatorStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ShapeStyle | A ShapeStyle representing the visual appearance of the separator line. |
Remarks
This property defines the visual styling (such as stroke color and thickness)
of the separator row when IsSeparator is set to true.
Examples
This example demonstrates customizing the separator style:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Order",
Attributes = new DiagramObjectCollection<UmlClassAttribute>()
{
new UmlClassAttribute()
{
IsSeparator = true,
SeparatorStyle = new ShapeStyle()
{
StrokeColor = "red",
StrokeWidth = 2
}
}
}
}
}
});
Methods
Clone()
Creates a new object that is a copy of the current UmlTypedElement.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| object | A new UmlTypedElement instance that is a deep copy of the current object. |
Overrides
Remarks
This method performs a deep copy, creating an independent instance with identical parameter name, type, and style.