Class NodeGroup
Represents a cluster of multiple nodes and connectors into a single element, functioning as a container for its children (nodes, groups, and connectors).
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class NodeGroup : Node, IDiagramObject, ICloneable
Remarks
This class allows for the logical grouping of multiple diagram objects, making it easier to manage and manipulate related nodes and connectors as a single unit.
Examples
<SfDiagramComponent Height="500px" @ref="diagram" Nodes="@nodes">
</SfDiagramComponent>
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node1 = createNode("node1", 100, 100);
Node node2 = createNode("node2", 300, 100);
NodeGroup groupNode = new NodeGroup();
// Grouping node 1 and node 2 into a single group
groupNode.Children = new string[] { "node1", "node2" };
nodes.Add(node1);
nodes.Add(node2);
nodes.Add(groupNode);
}
public Node createNode(string id, double offsetX, double offsetY)
{
Node node = new Node()
{
ID = id,
OffsetX = offsetX,
OffsetY = offsetY,
Height = 100,
Width = 100,
Style = new ShapeStyle() { Fill = "#6495ED" }
};
return node;
}
}
Constructors
NodeGroup()
Initializes a new instance of the NodeGroup.
Declaration
public NodeGroup()
NodeGroup(NodeGroup)
Declaration
public NodeGroup(NodeGroup src)
Parameters
Type | Name | Description |
---|---|---|
NodeGroup | src |
Properties
Children
Gets or sets the children of the group element.
Declaration
public string[] Children { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | A System.String array representing the identifiers of the children nodes. The default value is null. |
Remarks
This property allows you to specify the identifiers of nodes that will be included in a group. Grouping nodes helps in organizing them into a single logical unit, facilitating easier manipulations like moving and resizing.
Examples
<SfDiagramComponent Height = "500px" @ref="diagram" Nodes="@nodes">
</SfDiagramComponent>
@code
{
SfDiagramComponent diagram;
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
Node node1 = createNode("node1", 100, 100);
Node node2 = createNode("node2", 300, 100);
NodeGroup groupNode = new NodeGroup();
// Grouping node 1 and node 2 into a single group
groupNode.Children = new string[] { "node1", "node2" };
nodes.Add(node1);
nodes.Add(node2);
nodes.Add(groupNode);
}
public Node createNode(string id, double offsetX, double offsetY)
{
Node node = new Node()
{
ID = id,
OffsetX = offsetX,
OffsetY = offsetY,
Height = 100,
Width = 100,
Style = new ShapeStyle() { Fill = "#6495ED" }
};
return node;
}
}
Padding
Gets or sets the padding for the group node.
Declaration
public DiagramThickness Padding { get; set; }
Property Value
Type | Description |
---|---|
DiagramThickness | A DiagramThickness representing the amount of space between the group node's children and its boundary.
The default value is a thickness of |
Remarks
The padding defines the amount of space between the group node's children and its boundary.
Examples
<SfDiagramComponent Height="600px" Nodes="@nodes" />
@code
{
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
protected override void OnInitialized()
{
NodeGroup groupNode = new NodeGroup()
{
ID = "groupNode",
Children = new string[] {"node1", "node2"},
Padding = new DiagramThickness { Left = 10, Right = 10, Top = 10, Bottom = 10 }
};
nodes.Add(groupNode);
}
}
Methods
Clone()
Creates a new object that is a copy of the current group.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A NodeGroup representing a copy of the current group. |