-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDrawConstraintsWithDrawingObject.razor
More file actions
77 lines (73 loc) · 2.75 KB
/
Copy pathDrawConstraintsWithDrawingObject.razor
File metadata and controls
77 lines (73 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@page "/DrawConstraintsWithDrawingObject"
@using Syncfusion.Blazor.Diagram
<SfDiagramComponent Height="600px" Nodes="@_nodes" DrawingObject="_drawingObject"/>
@code
{
//Define diagram's nodes collection
private DiagramObjectCollection<Node> _nodes;
private IDiagramObject _drawingObject;
protected override void OnInitialized()
{
_nodes = new DiagramObjectCollection<Node>();
// Nodes are created and stored in nodes array.
Node node1 = new Node()
{
// Position of the node.
OffsetX = 250,
OffsetY = 250,
// Size of the node.
Width = 100,
Height = 100,
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
// Initialize port collection.
Ports = new DiagramObjectCollection<PointPort>()
{
new PointPort()
{
ID = "port1",
Offset = new DiagramPoint() { X = 1, Y = 0.5 },
Visibility = PortVisibility.Visible,
//Set the style for the port.
Style= new ShapeStyle(){ Fill = "gray", StrokeColor = "black"},
// Sets the shape of the port as Circle.
Width = 12, Height = 12, Shape = PortShapes.Square,
// Enable drag operation for Port.
Constraints = PortConstraints.Default|PortConstraints.Draw
}
},
};
_nodes.Add(node1);
Node node2 = new Node()
{
// Position of the node.
OffsetX = 500,
OffsetY = 350,
// Size of the node.
Width = 100,
Height = 100,
Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
// Initialize port collection.
Ports = new DiagramObjectCollection<PointPort>()
{
new PointPort()
{
ID = "port1",
Offset = new DiagramPoint() { X = 0, Y = 0.5 },
Visibility = PortVisibility.Visible,
//Set the style for the port.
Style= new ShapeStyle(){ Fill = "gray", StrokeColor = "black"},
// Sets the shape of the port as Circle.
Width = 12, Height = 12, Shape = PortShapes.Square,
// Enable drag operation for Port.
Constraints = PortConstraints.Default|PortConstraints.Draw
}
},
};
_nodes.Add(node2);
_drawingObject = new Connector()
{
ID = "connector1",
Type = ConnectorSegmentType.Bezier,
};
}
}