We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Moving LineConnectors with ports at runtime

Thread ID:





108371 Apr 16,2013 10:38 PM UTC Apr 19,2013 04:14 AM UTC WPF 2
Tags: Diagram
Todd Lichtas
Asked On April 16, 2013 10:38 PM UTC

I have a scenario where I am creating a connection between 2 nodes, but the connection line needs to be segmented.  To accomplish this, I created a port on a connection line between the 2 nodes with the following code

        Dim headnode As New Node()

        headnode.Shape = Shapes.RoundedRectangle

        headnode.Label = "Head Node"

        headnode.Height = 100

        headnode.Width = 100

        headnode.OffsetX = 200

        headnode.OffsetY = 200



        Dim tailnode As New Node()

        tailnode.Shape = Shapes.RoundedRectangle

        tailnode.Label = "Tail Node"

        tailnode.Height = 100

        tailnode.Width = 100

        tailnode.OffsetX = 400

        tailnode.OffsetY = 50



        Dim line As New LineConnector()

        Dim port As New ConnectionPort()

        port.PortStyle.Stroke = New SolidColorBrush(Colors.OrangeRed)

        port.PortStyle.Fill = New SolidColorBrush(Colors.OrangeRed)

        port.Width = 10

        port.Height = 10

        port.PortOffset = 0.0

        port.PortVisibility = PortVisibility.AlwaysVisible


        line.ConnectorType = ConnectorType.Straight

        line.TailNode = tailnode

        port.Edge = line



        Dim line1 As New LineConnector()

        line1.LineStyle.Stroke = New SolidColorBrush(Colors.Brown)

        line1.TailDecoratorStyle.Stroke = New SolidColorBrush(Colors.Brown)

        line1.TailDecoratorStyle.Fill = New SolidColorBrush(Colors.Brown)

        line1.TailDecoratorShape = Syncfusion.Windows.Diagram.DecoratorShape.None

        line1.ConnectionTailPort = port

        line1.ConnectorType = ConnectorType.Straight

        line1.HeadNode = headnode


When I select the LineConnector attached to the Tail Node, and reposition the line, the port moves also which is what I want.  However, if I select the LineConnector, attached to the Head Node, and reposition the line, the line detaches from the port.  Is there a way to either allow the port to be relocated if either the Head or Tail LineConnector is repositioned?  Or is there a way to allow the port to be dragged to a new location on the View?

Todd Lichtas
Replied On April 17, 2013 05:20 PM UTC

I came up with a solution to this by using another type of node rather than Ports on a Line.  This allowed me to have a segmented line with one or more "connectionNodes" between the "actual" nodes.

Sudhakar C [Syncfusion]
Replied On April 19, 2013 04:14 AM UTC

Hi Todd,


Thanks for the update. This will be work fine. And also, please let us know if you have any other concerns. As always, we will be happy to assist you. Thanks for using Syncfusion Products.




Sudhakar C


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon