Skip to content

Commit 092d712

Browse files
Merge pull request #4695 from syncfusion-content/ES-892736-FiniteDirection
ES 892732: Added documentation for Port Direction.
2 parents fc3efc4 + 5ba7bb9 commit 092d712

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
338 KB
Loading

blazor/diagram/ports/ports.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,89 @@ protected override void OnInitialized()
352352
```
353353
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/Ports/ActionofPorts/UpdatePorts)
354354

355+
## How to specify connection direction to port
356+
357+
The [ConnectionDirection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.Port.html#Syncfusion_Blazor_Diagram_Port_ConnectionDirection) property of a port allows users to specify the direction in which a connector should establish a connection. This can be either to the port incoming or from the port outgoing.
358+
359+
The following code example how to set connection direction to port.
360+
```cshtml
361+
@using Syncfusion.Blazor.Diagram
362+
363+
364+
<SfDiagramComponent Width="600px" Height="600px" Nodes="@nodes" Connectors="@connectors" >
365+
</SfDiagramComponent>
366+
367+
368+
@code
369+
{
370+
//Defines Diagram's Nodes collection
371+
private DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
372+
//Defines Diagram's Connectors collection
373+
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
374+
375+
protected override void OnInitialized()
376+
{
377+
Node node1 = new Node()
378+
{
379+
ID = "node1",
380+
// Position of the node.
381+
OffsetX = 450,
382+
OffsetY = 200,
383+
// Size of the node.
384+
Width = 100,
385+
Height = 100,
386+
Style = new ShapeStyle() { Fill = "#6BA5D7" },
387+
Ports = new DiagramObjectCollection<PointPort>()
388+
{
389+
new PointPort()
390+
{ ID="port1",
391+
Offset = new DiagramPoint() { X = 0, Y = 0 },
392+
Visibility = PortVisibility.Visible,
393+
}
394+
}
395+
};
396+
nodes.Add(node1);
397+
Node node2 = new Node()
398+
{
399+
ID = "node2",
400+
// Position of the node.
401+
OffsetX = 270,
402+
OffsetY = 300,
403+
// Size of the node.
404+
Style = new ShapeStyle() { Fill = "#6BA5D7" },
405+
Width = 100,
406+
Height = 100,
407+
Ports = new DiagramObjectCollection<PointPort>()
408+
{
409+
new PointPort()
410+
{ ID="port2",
411+
Offset = new DiagramPoint() { X = 0.5, Y = 0.5 },
412+
Visibility = PortVisibility.Visible,
413+
//Sets the connection direction as Left
414+
ConnectionDirection = PortConnectionDirection.Left
415+
}
416+
}
417+
};
418+
// Add node.
419+
nodes.Add(node2);
420+
Connector Connector1 = new Connector()
421+
{
422+
ID = "connector1",
423+
// Set the source and target point of the connector.
424+
SourceID = "node2",
425+
TargetID = "node1",
426+
SourcePortID = "port2",
427+
TargetPortID = "port1",
428+
// Type of the connector segments.
429+
Type = ConnectorSegmentType.Orthogonal
430+
};
431+
connectors.Add(Connector1);
432+
}
433+
}
434+
```
435+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/Ports/ActionofPorts/PortDirection)
436+
437+
![Port Connection Direction](../images/PortDirection.gif)
355438

356439
## How to get InEdges and OutEdges of ports
357440

0 commit comments

Comments
 (0)