Class Container
Represents a graphical element used to visually group logically related diagram elements on a page.
Inherited Members
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()
Declaration
public Container()
Container(Container)
Declaration
public Container(Container src)
Parameters
Type | Name | Description |
---|---|---|
Container | src |
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
Implements
System.ICloneable