Class UmlClassifierShape
Represents a UML classifier node in a diagram.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.Diagram.dll
Syntax
public class UmlClassifierShape : Shape, IDiagramObject, ICloneable
Remarks
This shape can render different UML classifier types such as Class, Interface, and Enumeration, with their respective structural compartments (attributes, operations, or members).
Examples
// Create a UML Class node
nodes.Add(new Node()
{
Style = new ShapeStyle() { Fill = "lightyellow" },
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
HeaderStyle = new TextStyle() { Fill = "yellow" },
ClassShape = new UmlClass()
{
Name = "Animal"
}
}
});
// Create a UML Interface node
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Interface,
InterfaceShape = new UmlInterface()
{
Name = "IMovable"
}
}
});
// Create a UML Enumeration node
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Enumeration,
EnumerationShape = new UmlEnumeration()
{
Name = "Direction"
}
}
});
Constructors
UmlClassifierShape()
Creates a new instance of the UmlClassifierShape.
Declaration
public UmlClassifierShape()
UmlClassifierShape(UmlClassifierShape)
Creates a new instance of the UmlClassifierShape.
Declaration
public UmlClassifierShape(UmlClassifierShape src)
Parameters
| Type | Name | Description |
|---|---|---|
| UmlClassifierShape | src | The source UmlClassifierShape to copy from. |
Properties
ClassShape
Gets or sets the UML class definition associated with this shape.
Declaration
[JsonPropertyName("classShape")]
public UmlClass ClassShape { get; set; }
Property Value
| Type | Description |
|---|---|
| UmlClass | A UmlClass representing the class definition. |
Remarks
This property is active when Classifier is set to ClassifierShape.Class and defines the class name, attributes, methods, and their visual configuration.
Examples
This example demonstrates assigning a UML class to a node:
nodes.Add(new Node()
{
ID = "classNode",
OffsetX = 250,
OffsetY = 200,
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Vehicle"
}
}
});
Classifier
Gets or sets the classifier type that determines which UML shape is rendered.
Declaration
[JsonPropertyName("classifier")]
public ClassifierShape Classifier { get; set; }
Property Value
| Type | Description |
|---|---|
| ClassifierShape | A ClassifierShape indicating the active classifier type.
The default value is |
Remarks
Determines which classifier shape is rendered in the node based on its value:
Class- Renders a UML class shapeInterface- Renders a UML interface shapeEnumeration- Renders a UML enumeration shape
Examples
This example demonstrates switching between UML classifier types:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Interface,
InterfaceShape = new UmlInterface()
{
Name = "IMovable"
}
}
});
EnumerationShape
Gets or sets the UML enumeration definition associated with this shape.
Declaration
[JsonPropertyName("enumerationShape")]
public UmlEnumeration EnumerationShape { get; set; }
Property Value
| Type | Description |
|---|---|
| UmlEnumeration | A UmlEnumeration representing the enumeration definition. |
Remarks
This property is active when Classifier is set to ClassifierShape.Enumeration and defines the enumeration name and its members.
It is used only when Classifier is set to Enumeration.
Examples
This example demonstrates creating an enumeration node:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Enumeration,
EnumerationShape = new UmlEnumeration()
{
Name = "Direction"
}
}
});
HeaderStyle
Gets or sets the text style applied to the classifier header section.
Declaration
[JsonPropertyName("headerStyle")]
public TextStyle HeaderStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle | A TextStyle that defines the appearance of the classifier header. The default value is a white-filled style. |
Remarks
This typically styles the classifier name (e.g., class name, enumeration name).
Examples
This example demonstrates how to customize the header style of a UML class node:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
HeaderStyle = new TextStyle()
{
Fill = "yellow",
Color = "black"
},
ClassShape = new UmlClass()
{
Name = "Animal"
}
}
});
InterfaceShape
Gets or sets the UML interface definition associated with this shape.
Declaration
[JsonPropertyName("interfaceShape")]
public UmlInterface InterfaceShape { get; set; }
Property Value
| Type | Description |
|---|---|
| UmlInterface | A UmlInterface representing the interface definition. |
Remarks
This property is active when Classifier is set to ClassifierShape.Interface and defines the interface name along with its attributes and operations.
It is used only when Classifier is set to Interface.
Examples
This example demonstrates defining an interface node:
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Interface,
InterfaceShape = new UmlInterface()
{
Name = "IRunnable"
}
}
});
Methods
Clone()
Creates a new UmlClassifierShape that is a copy of the current style.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| object | A new instance of UmlClassifierShape that is a copy of the current instance. |