menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class NodeGroup - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    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).

    Inheritance
    System.Object
    DiagramObject
    NodeBase
    Node
    NodeGroup
    Container
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Node.Annotations
    Node.BackgroundColor
    Node.BorderColor
    Node.BorderWidth
    Node.CollapseIcon
    Node.Constraints
    Node.Data
    Node.ExpandIcon
    Node.FixedUserHandles
    Node.Height
    Node.HorizontalAlignment
    Node.InEdges
    Node.IsExpanded
    Node.LaneOffsetX
    Node.LaneOffsetY
    Node.MaxHeight
    Node.MaxWidth
    Node.MinHeight
    Node.MinWidth
    Node.OffsetX
    Node.OffsetY
    Node.OutEdges
    Node.Pivot
    Node.Ports
    Node.RotationAngle
    Node.Shadow
    Node.Shape
    Node.Style
    Node.VerticalAlignment
    Node.Width
    NodeBase.AdditionalInfo
    NodeBase.CanAutoLayout
    NodeBase.Flip
    NodeBase.FlipMode
    NodeBase.ID
    NodeBase.IsVisible
    NodeBase.Margin
    NodeBase.SearchTags
    NodeBase.Tooltip
    NodeBase.ZIndex
    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)

    Creates a new instance of the NodeGroup from the given 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 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

    A NodeGroup representing a copy of the current group.

    Overrides
    Node.Clone()

    Implements

    IDiagramObject
    System.ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved