Class NodeGroup
Represents a cluster of multiple nodes and connectors into a single element. It acts like 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
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 |
---|
System.String[] |
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 | The amount of space between the group node's children and its boundary. The default is a thickness of 0 on all four sides. |
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 | Group |
Overrides
Implements
System.ICloneable