diff --git a/Diagram/Server/Pages/Methods/AddAsyncMethod.razor b/Diagram/Server/Pages/Methods/AddAsyncMethod.razor
new file mode 100644
index 00000000..80ddb08c
--- /dev/null
+++ b/Diagram/Server/Pages/Methods/AddAsyncMethod.razor
@@ -0,0 +1,56 @@
+@page "/AddAsyncMethod"
+
+@using Syncfusion.Blazor.Diagram
+@using Syncfusion.Blazor.Buttons
+
+
+
+
+
+
+@code
+{
+ // Reference the diagram.
+ private SfDiagramComponent _diagram;
+
+ // Initialize the nodes and connectors collections.
+ private DiagramObjectCollection _nodes = new DiagramObjectCollection();
+ private DiagramObjectCollection _connectors = new DiagramObjectCollection();
+
+ protected override void OnInitialized()
+ {
+ Node node = new Node()
+ {
+ ID = "node1",
+ OffsetX = 300,
+ OffsetY = 200,
+ Width = 120,
+ Height = 60,
+ Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "#6495ED" },
+ Shape = new BasicShape() { Type = NodeShapes.Basic, Shape = NodeBasicShapes.Rectangle },
+ };
+
+ _nodes.Add(node);
+ }
+
+ private async Task AddPortAndAnnotationAsync()
+ {
+ Node node = _diagram.Nodes[0];
+
+ await node.Ports.AddAsync(new PointPort()
+ {
+ ID = "port1",
+ Offset = new DiagramPoint() { X = 1, Y = 0.5 },
+ Visibility = PortVisibility.Visible,
+ Height = 10,
+ Width = 10,
+ Style = new ShapeStyle() { Fill = "#FFFFFF", StrokeColor = "#1F3A93" }
+ });
+
+ await node.Annotations.AddAsync(new ShapeAnnotation()
+ {
+ Content = "Node 1",
+ Offset = new DiagramPoint() { X = 0.5, Y = 0.5 }
+ });
+ }
+}
\ No newline at end of file
diff --git a/Diagram/Server/Pages/Methods/AddDiagramElements.razor b/Diagram/Server/Pages/Methods/AddDiagramElements.razor
index 0e70abff..4cf5e304 100644
--- a/Diagram/Server/Pages/Methods/AddDiagramElements.razor
+++ b/Diagram/Server/Pages/Methods/AddDiagramElements.razor
@@ -84,10 +84,44 @@
// Type of the connector
Type = ConnectorSegmentType.Straight,
};
+
+ Swimlane swimlane = new Swimlane()
+ {
+ ID = "swimlane1",
+ OffsetX = 650,
+ OffsetY = 200,
+ Height = 150,
+ Width = 450,
+ Header = new SwimlaneHeader()
+ {
+ Annotation = new ShapeAnnotation() { Content = "Sales Process" },
+ Height = 50,
+ },
+ Lanes = new DiagramObjectCollection()
+ {
+ new Lane()
+ {
+ ID = "lane1",
+ Height = 100,
+ Header = new SwimlaneHeader()
+ {
+ Width = 30,
+ Annotation = new ShapeAnnotation() { Content = "Consumer" }
+ },
+ Children = new DiagramObjectCollection()
+ {
+ new Node(){Height = 50, Width = 50, LaneOffsetX = 100, LaneOffsetY = 30},
+ new Node(){Height = 50, Width = 50, LaneOffsetX = 250, LaneOffsetY = 30},
+ }
+ }
+ }
+ };
+
DiagramObjectCollection nodeCollection = new DiagramObjectCollection();
nodeCollection.Add(node1);
nodeCollection.Add(node2);
nodeCollection.Add(Connector);
+ nodeCollection.Add(swimlane);
await _diagram.AddDiagramElementsAsync(nodeCollection);
}
}
\ No newline at end of file