Skip to content

Commit 6a9d5ba

Browse files
committed
892736: Updated Document for Port Direction.
1 parent bd2d51c commit 6a9d5ba

File tree

1 file changed

+84
-1
lines changed

1 file changed

+84
-1
lines changed

blazor/diagram/ports/ports.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,95 @@ 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_ConnectionDirecction) 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

358441
[InEdges](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.Port.html#Syncfusion_Blazor_Diagram_Port_InEdges) is used to get the incoming connectors of the port that are connected to the port. [OutEdges](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.Port.html#Syncfusion_Blazor_Diagram_Port_OutEdges) is used to get the outgoing connectors of the port that are connected to the port.
359442

360-
The following code example how to get inedges and outedges of port.
443+
The following code example how to get [InEdges](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.Port.html#Syncfusion_Blazor_Diagram_Port_InEdges) and [OutEdges](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.Port.html#Syncfusion_Blazor_Diagram_Port_OutEdges) of port.
361444
```cshtml
362445
@using Syncfusion.Blazor.Diagram
363446
@using Syncfusion.Blazor.Buttons

0 commit comments

Comments
 (0)