This is a migrated thread and some comments may be shown as answers.

Force connection to Left connector

1 Answer 113 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 2
Iron
Veteran
Iron
Rob asked on 10 Jan 2017, 05:22 AM

Just researching this component to see if it can do what I want.

I have slightly modified the 'First look' example to see if I can modify it to suit. 

From reading the documentation, I should be able to force the connector to attach to a shape on one side , but I cannot get it to work.

As a simple test I tried to add a connection between a member to a Node

    Private Sub PopulateWithData()
        Dim dataXml As XElement = XElement.Load("Organization.xml")
        For Each element As XElement In dataXml.Elements("Node")
            Dim node As OrgContainerShape = Me.CreateNode(element, Nothing)
            node.BaseColor = Me.groupColor(0)
            Me.RadDiagram1.AddShape(node)
            currentLayoutSettings.Roots.Add(node)
            Me.GetSubNodes(element, node, 2)
        Next
'------- Add a new connection as a test -------------------------------
        Dim connection As New RadDiagramConnection()
        connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline
        Dim parentNode = Me.RadDiagram1.Shapes(0)
        Dim destNode = Me.RadDiagram1.Shapes(7)
        connection.Source = parentNode
        connection.Target = destNode
        connection.SourceConnectorPosition = "Left"
        connection.TargetConnectorPosition = "Auto"
        Me.RadDiagram1.AddConnection(connection)
    End Sub

 

But it always connects to the bottom of the shape.

What am I doing wrong? ( I have checked and the shape does have a Left connector)

Many thanks

Rob

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Jan 2017, 11:03 AM
Hello Rob,

Thank you for writing.  

By default, SourceConnectorPosition/TargetConnectorPosition properties of RadDiagramConnection controls where the connection to be placed. There are five predefined strings that you can use to define where to position the connectors of the connection. Please refer to the following help article: http://docs.telerik.com/devtools/winforms/diagram/diagram-items/connections/connections

Actually, the connection is at the bottom of the shape, not on the left. Please refer to the attached screenshot. However, the Organization Chart example represents a highly customized RadDiagram. This is intended behavior for this example because it is supposed to display a hierarchy from top to bottom. Hence, the connections are placed at the bottom/top of the shape respectively after applying the LayoutType.Tree. That is why in order to obtain the connection with the desired connectors position, add it in the Form.Shown event after the layout is applied.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Rob
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or