Articles in this section
Category / Section

How to connect only with port not with node in WPF Diagram (SfDiagram)?

1 min read

By default, you can connect nodes or its ports by dragging the endpoints of the connector or by using drawing tools in WPF Diagram (SfDiagram). You can decide over the connection to the node or port by using the Constraints property.

For example, achieving port to port connection alone in the diagram are explained as follows:

  • Disable connection behavior from the node.
  • Stop or disable ports inheriting behavior. Since, port behavior will be inherited from its parent (i.e., Node).

Refer to the following code example and sample link for the previously explained scenario.

C#

node1.Constraints &= ~NodeConstraints.Connectable;
port1.Constraints = PortConstraints.Connectable & ~PortConstraints.InheritConnectable;
 
Here node1 is the instance of the NodeViewModel and port1 is the instance of NodePortViewModel.

View sample in GitHub.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied