Class CommonElement
Represents the base class for all UI building blocks used in diagram nodes and connectors within the SfDiagramComponent.
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public abstract class CommonElement : Object
Remarks
This abstract class provides the foundation for sizing and positioning all diagram elements. Derived classes such as PathElement and TextElement extend this functionality for specialized rendering.
Elements can be combined to create complex node and connector structures within diagrams.
Constructors
CommonElement()
Declaration
protected CommonElement()
Properties
ActualSize
Gets or sets the actual size of the Element that will be rendered in the diagram.
Declaration
public DiagramSize ActualSize { get; set; }
Property Value
Type | Description |
---|---|
DiagramSize | A DiagramSize representing the computed dimensions of the element. The default value is a new DiagramSize instance with zero width and height. |
Remarks
This property represents the actual size of the Element.
Bounds
Gets the size and location of the element in pixels, including its non-client elements relative to the parent control.
Declaration
public DiagramRect Bounds { get; set; }
Property Value
Type | Description |
---|---|
DiagramRect | A DiagramRect representing the actual size of the element and its position within the parent container. The default value is a new DiagramRect instance with zero coordinates and dimensions. |
Remarks
Defines the area occupied by the element in pixels, including client and non-client elements. Changes may trigger layout updates in the parent container.
CornerRadius
Gets or sets a value that represents the degree to which the corners of a border are rounded. It is only applicable to Element.
Declaration
public double CornerRadius { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the radius of the corners in pixels. The default value is |
Remarks
A value of 0 creates sharp corners, while higher values create more rounded corners applied uniformly to all four corners.
DesiredSize
Gets or sets the exact size at which the element should be rendered.
Declaration
public DiagramSize DesiredSize { get; set; }
Property Value
Type | Description |
---|---|
DiagramSize | A DiagramSize representing the final calculated dimensions for element rendering. The default value is a new DiagramSize instance with default dimensions. |
Remarks
This computed size considers all layout constraints and may differ from initially requested dimensions. When null, the parent container determines the element size.
Flip
Gets or sets the mirror image of diagram element in both horizontal and vertical directions.
Declaration
public FlipDirection Flip { get; set; }
Property Value
Type | Description |
---|---|
FlipDirection | The default value will be None |
FlipMode
The FlipMode is used to control the behaviour of the flip object.
Declaration
public DiagramFlipMode FlipMode { get; set; }
Property Value
Type |
---|
DiagramFlipMode |
Height
Gets or sets the height of the element.
Declaration
public Nullable<double> Height { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the height constraint for the element in pixels. The default value is null. |
Remarks
When null, the element sizes based on its content. When specified, the value must be non-negative.
HorizontalAlignment
Gets or sets the horizontal alignment of the element relative to its immediate parent container.
Declaration
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Type | Description |
---|---|
HorizontalAlignment | A HorizontalAlignment value specifying how the element is horizontally positioned within its parent container. The default value is Auto. |
Remarks
Determines how the element is positioned horizontally. Auto uses the parent's default alignment behavior.
ID
Gets or sets the unique identifier for the element.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the unique identifier for the element. The default value is null. |
IsDirt
Gets or sets whether the content of the element needs to be measured or not. If it is false, the element will not measure unnecessary scenarios
Declaration
protected bool IsDirt { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true, content of the element needs to be measured; otherwise, false |
Margin
Gets or sets the extra space around the outer boundaries of the element
Declaration
public DiagramThickness Margin { get; set; }
Property Value
Type | Description |
---|---|
DiagramThickness | A DiagramThickness representing the margin spacing in logical units around the element.
The default value is a DiagramThickness with all sides set to |
Remarks
Creates additional space outside the element's boundaries. Set to null to remove margin spacing.
MaxHeight
Gets or sets the maximum height of the element.
Declaration
public Nullable<double> MaxHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the maximum height constraint for the element in pixels. The default value is null. |
Remarks
Constrains the element's maximum rendered height. A null value applies no constraint.
MaxWidth
Gets or sets the maximum width of the element.
Declaration
public Nullable<double> MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the maximum width constraint in pixels. The default value is null. |
Remarks
Constrains the element's maximum rendered width. A null value applies no constraint.
MinHeight
Gets or sets the minimum height of the element.
Declaration
public Nullable<double> MinHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the minimum height for the element in pixels. The default value is null. |
Remarks
When set, ensures the element will not render smaller than the specified height. A null value applies no constraint.
MinWidth
Gets or sets the minimum width of the element.
Declaration
public Nullable<double> MinWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the minimum width constraint in pixels. The default value is null. |
Remarks
Prevents the element from being rendered smaller than the specified width. A null value applies no constraint.
OffsetX
Gets or sets the X-coordinate position of the element.
Declaration
public double OffsetX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the horizontal position of the element. The default value is |
Remarks
Determines the horizontal positioning relative to the parent container. Positive values move right, negative values move left.
OffsetY
Gets or sets the y-coordinate position of the element.
Declaration
public double OffsetY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the vertical position of the element. The default value is |
Remarks
Determines the vertical positioning of the element. Positive values move the element downward, negative values move it upward.
OuterBounds
Gets or sets the element's outside bounds, including all margin and padding properties.
Declaration
public DiagramRect OuterBounds { get; set; }
Property Value
Type | Description |
---|---|
DiagramRect | A DiagramRect representing the complete outer boundary of the element. The default value is the element's Bounds when no floating bounds are specified. |
Remarks
Returns floating bounds when set, otherwise falls back to the standard Bounds property.
ParentID
Gets or sets the parent identifier of the element.
Declaration
public string ParentID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the unique identifier of the parent element. The default value is null. |
Remarks
Establishes parent-child relationship in hierarchical structures. When null, the element is considered a root-level element.
Pivot
Gets or sets the pivot point for the element. The element's rotation angle will be based on pivot values.
Declaration
public DiagramPoint Pivot { get; set; }
Property Value
Type | Description |
---|---|
DiagramPoint | A DiagramPoint representing the pivot point coordinates for rotation operations. The default value is |
Remarks
The pivot point determines the element's rotation using normalized coordinates, where (0,0) is top-left and (1,1) is bottom-right.
RelativeMode
Gets or sets the relative positioning mode that determines whether the element is aligned based on offset values or its immediate parent.
Declaration
public RelativeMode RelativeMode { get; set; }
Property Value
Type | Description |
---|---|
RelativeMode | A RelativeMode specifying how the element should be positioned relative to its reference point. The default value is Point. |
Remarks
Controls element alignment behavior: Point uses offset value.
RotationAngle
Gets or sets the rotate angle of the element.
Declaration
public double RotationAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the rotation angle in degrees. The default value is |
Remarks
Positive values rotate clockwise, negative values rotate counter-clockwise. Values are normalized to 0-360 degrees range.
Shadow
Gets or sets the shadow appearance of a node.
Declaration
public Shadow Shadow { get; set; }
Property Value
Type | Description |
---|---|
Shadow | A Shadow object that defines the shadow effects applied to the element. The default value is null. |
Remarks
Creates a shadow effect behind the element. When null, no shadow is shown.
Style
Gets or sets the visual appearance styling.
Declaration
public ShapeStyle Style { get; set; }
Property Value
Type | Description |
---|---|
ShapeStyle | A ShapeStyle object that defines the visual properties of the element.
The default value is a new ShapeStyle instance with Fill = |
Remarks
Controls the visual rendering including fill color, stroke appearance, and opacity. Setting to null uses default styling behavior.
VerticalAlignment
Gets or sets the vertical alignment of the element within its parent container.
Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
VerticalAlignment | A VerticalAlignment specifying how the element is positioned vertically within its parent's available space. The default value is Auto. |
Remarks
Determines how the element is positioned vertically. Auto uses the parent's default alignment behavior.
Visible
Gets or sets a value indicating whether the content of the element is visible.
Declaration
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A System.Boolean indicating the visibility state of the element's content. The default value is true. |
Remarks
When set to false, the element's content is hidden but remains in the layout structure.
Width
Gets or sets the width of the element. If it is not specified, the element renders based on the content's width
Declaration
public Nullable<double> Width { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double? representing the width of the element in pixels. The default value is null. |
Remarks
When null, the element sizes based on content. When specified, the value must be non-negative.