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.
Unfortunately, activation email could not send to your email. Please try again.

Moving LineConnectors with ports at runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

108371 Apr 16,2013 06:38 PM Apr 19,2013 12:14 AM WPF 2
loading
Tags: Diagram
Todd Lichtas
Asked On April 16, 2013 06:38 PM

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

        diagramModel.Nodes.Add(headnode)

 

        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

        diagramModel.Nodes.Add(tailnode)

 

        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.Ports.Add(port)

        line.ConnectorType = ConnectorType.Straight

        line.TailNode = tailnode

        port.Edge = line

        diagramModel.Connections.Add(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

        diagramModel.Connections.Add(line1)

 
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 01:20 PM

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 12:14 AM

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.

 

Regards,

 

Sudhakar C


CONFIRMATION

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.

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.

;