Skip to content

Task(ES-862832): port draw using drawing object #3676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified blazor/diagram/images/blazor-diagram-draw-port-connection.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 19 additions & 3 deletions blazor/diagram/ports/interaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,28 @@ The port can be used to create connector by enabling the `Draw` in the [PortCons

## How to draw connector from the port

Diagram provides the support to draw the connector in the port.
Diagram provides the support to draw the connector in the port.The type of connector segment can be specified using the [DrawingObject](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.SfDiagramComponent.html#Syncfusion_Blazor_Diagram_SfDiagramComponent_DrawingObject) property. This enables the drawing of ports with various connector types, including:
* Staright
* Bezier
* Polyline
* Orthagonal
* Free Hand


The following code explains how to draw the connector by using the port constraints.

```cshtml
@using Syncfusion.Blazor.Diagram

<SfDiagramComponent Height="600px" Nodes="@nodes" />
<SfDiagramComponent @ref="diagram" Height="600px" Nodes="@nodes" DrawingObject="DrawingObject"/>

@code
{
DiagramObjectCollection<Node> nodes;

protected override void OnInitialized()
{
public SfDiagramComponent diagram;
nodes = new DiagramObjectCollection<Node>();
// A node is created and stored in nodes array.
Node node = new Node()
Expand Down Expand Up @@ -63,12 +70,21 @@ The following code explains how to draw the connector by using the port constrai
},
};
nodes.Add(node);
DrawingObject = new Connector()
{
ID = "connector1",
Type = ConnectorSegmentType.Straight,
};
}
}
```
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/Ports/Interaction)

![Drawing Port Connection in Blazor Diagram](../images/blazor-diagram-draw-port-connection.gif)
![Drawing Bezier Port Connection in Blazor Diagram](../images/blazor-diagram-draw-port-connection.gif)

By default, the connector segment type is set to [Orthogonal](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ConnectorSegmentType.html#Syncfusion_Blazor_Diagram_ConnectorSegmentType_Orthogonal)

![Drawing Default Port Connection in Blazor Diagram](../images/blazor-diagram-draw-port-connection-default.gif)

## See also

Expand Down