Skip to content

Commit b36cb99

Browse files
Merge pull request #4464 from Syncfusion-Content/development
DOCINFRA-2341_merged_using_automation
2 parents 0988f6d + a0856b7 commit b36cb99

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

blazor/diagram/connectors/customization.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,93 @@ The following code example illustrates how to set the connection padding value f
734734
}
735735
```
736736
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/Connectors/Customization/ConnectionPadding)
737+
738+
### How to enable Connector Split
739+
740+
Connectors are used to create links between two points, ports, or nodes to represent the relationships between them. By enabling the [EnableConnectorSplitting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.SfDiagramComponent.html#Syncfusion_Blazor_Diagram_SfDiagramComponent_EnableConnectorSplitting) property, you can split a connector between two nodes when a new node is dropped onto the existing connector. This action creates a connection between the new node and the existing nodes.
741+
When a node is dropped on a point-to-point connection, it connects as the source for the target connector. Dropping another node on the target connector with only a source connection will connect the dropped node as its target, creating a complete connection. If a node is dropped on an existing node-to-node connection, the connector between the two nodes splits, creating a connection between the new node and the existing nodes.
742+
By default, [EnableConnectorSplitting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.SfDiagramComponent.html#Syncfusion_Blazor_Diagram_SfDiagramComponent_EnableConnectorSplitting) is set to false.
743+
744+
The following code illustrates how to enable connector splitting and create connections with a new node.
745+
```cshtml
746+
@using Syncfusion.Blazor.Diagram
747+
<SfDiagramComponent @ref="Diagram" Width="1000px" Height="500px" Nodes="@nodes" Connectors="@connectors" EnableConnectorSplitting="true">
748+
749+
</SfDiagramComponent>
750+
@code {
751+
//Reference the diagram
752+
SfDiagramComponent Diagram;
753+
// Initialize diagram's connector collection
754+
DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
755+
// Initialize diagram's node collection
756+
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
757+
protected override void OnInitialized()
758+
{
759+
nodes = new DiagramObjectCollection<Node>() {
760+
new Node() { OffsetX = 100,
761+
OffsetY = 100,
762+
Height = 50,
763+
Width = 100,
764+
ID = "node1",
765+
Style = new ShapeStyle(){ Fill = "#6495ED",
766+
StrokeColor = "#6495ED",},
767+
Shape = new BasicShape() { Type = NodeShapes.Basic, Shape = NodeBasicShapes.Rectangle }
768+
},
769+
new Node() { OffsetX = 300,
770+
OffsetY = 300,
771+
Height = 50,
772+
Width = 100,
773+
ID = "node2",
774+
Style = new ShapeStyle(){ Fill = "#6495ED",
775+
StrokeColor = "#6495ED",},
776+
Shape = new BasicShape() { Type = NodeShapes.Basic, Shape = NodeBasicShapes.Rectangle }
777+
},
778+
new Node() { OffsetX = 300,
779+
OffsetY = 100,
780+
Height = 50,
781+
Width = 100,
782+
ID = "node3",
783+
Style = new ShapeStyle(){ Fill = "#6495ED",
784+
StrokeColor = "#6495ED",},
785+
Shape = new BasicShape() { Type = NodeShapes.Basic, Shape = NodeBasicShapes.Rectangle }
786+
}
787+
};
788+
Connector Connector = new Connector()
789+
{
790+
ID = "connector1",
791+
//Source node id of the connector.
792+
SourceID = "node1",
793+
TargetDecorator = new DecoratorSettings()
794+
{
795+
Style = new ShapeStyle()
796+
{
797+
Fill = "#6495ED",
798+
StrokeColor = "#6495ED",
799+
}
800+
},
801+
//Target node id of the connector.
802+
TargetID = "node2",
803+
Style = new ShapeStyle()
804+
{
805+
Fill = "#6495ED",
806+
StrokeColor = "#6495ED",
807+
},
808+
// Type of the connector
809+
Type = ConnectorSegmentType.Straight,
810+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.AllowDrop,
811+
};
812+
connectors.Add(Connector);
813+
}
814+
}
815+
```
816+
![ConnectorSplitting](../images/ConnectorSplitDemo.gif)
817+
818+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/Interaction)
819+
820+
>**Note:** The [AllowDrop](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ConnectorConstraints.html#Syncfusion_Blazor_Diagram_ConnectorConstraints_AllowDrop) constraints must be enabled for the connector to allow dropping a node.
821+
822+
823+
737824
## See also
738825

739826
* [How to interact with the connector](./interactions)
219 KB
Loading

0 commit comments

Comments
 (0)