menu

Blazor

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

    Show / Hide Table of Contents

    Class Container

    Represents a graphical element used to visually group logically related diagram elements on a page.

    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
    NodeGroup.Children
    NodeGroup.Padding
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class Container : NodeGroup, IDiagramObject, ICloneable
    Remarks

    A Container allows dynamic interaction with its contents, enabling shapes to be added or removed by dragging them in or out. Unlike a NodeGroup, which unites multiple shapes into a single object that can only be moved, resized, or rotated as a whole, a Container provides flexibility for managing individual elements within the group.

    Constructors

    Container()

    Initializes a new instance of the Container class with default settings. Sets the height to 150, width to 200, stroke color to black, fill color to white, stroke width to 1.0, and Z-index to -1.

    Declaration
    public Container()

    Container(Container)

    Initializes a new instance of the Container class by copying an existing instance.

    Declaration
    public Container(Container src)
    Parameters
    Type Name Description
    Container src

    The source Container to copy from.

    Properties

    Header

    Gets or sets the header for the container. The header provides a title or other descriptive information for the container.

    Declaration
    public ContainerHeader Header { get; set; }
    Property Value
    Type
    ContainerHeader
    Examples
    @using Syncfusion.Blazor.Diagram
    <SfDiagramComponent @ref="@diagram" Height= "600px" Nodes= "@nodes" Connectors="@connectors" />
    @code
    {
    SfDiagramComponent diagram;
    //Initialize the node collection
    DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
    //Initialize the connector collection
    DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
    protected override void OnInitialized()
       {
           Node node1 = new Node()
           {
               ID = "node1",
               Height = 50,
               Width = 50,
               OffsetX = 100,
               OffsetY = 200
           };
           Node node2 = new Node()
           {
               ID = "node2",
               Height = 50,
               Width = 50,
               OffsetX = 200,
               OffsetY = 200
           };
           Connector connector = new Connector()
           {
               ID = "connector",
               SourcePoint = new DiagramPoint() { X = 300, Y = 200 },
               TargetPoint = new DiagramPoint() { X = 400, Y = 300 }
           };
           Container container = new Container()
           {
               ID = "container",
               Header = new ContainerHeader()
               {
                   ID = "containerHeader",
                   Annotation = new ShapeAnnotation()
                   {
                       Content = "Container Title"
                   },
                   Style = new TextStyle()
                   {
                       Fill = "teal"
                   },
                   Height = 50
               },
               Children = new string[] { "node1", "node2", "connector" },
               Height = 200, Width = 200
           };
           nodes.Add(node1);
           nodes.Add(node2);
           connectors.Add(connector);
           nodes.Add(container);
       }
    }

    Methods

    Clone()

    Creates a new instance of the Container class that is a copy of the current instance.

    Declaration
    public override object Clone()
    Returns
    Type Description
    System.Object

    A new Container object that is a copy of this instance.

    Overrides
    NodeGroup.Clone()

    Implements

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