ConnectionType="Polyline" but still Straight

2 posts, 0 answers
  1. YB
    YB avatar
    3 posts
    Member since:
    Jan 2014

    Posted 09 Mar 2014 Link to this post

    Here is my code :
                <telerik:RadDiagramShape Position="100,50" Width="100" Height="80" Name="one"/>
                <telerik:RadDiagramShape Position="250,100" Width="100" Height="80" Name="two"/>
                <telerik:RadDiagramShape Position="350,200" Width="100" Height="80" Name="three"/>
                <telerik:RadDiagramConnection Source="{Binding ElementName=one}" Target="{Binding ElementName=three}" ConnectionType="Polyline"/>

    The RadDiagramConnection is still Straight,why ?
  2. Martin
    Martin avatar
    1048 posts

    Posted 12 Mar 2014 Link to this post


    A polyline (or polygonal chain) is a continuous line composed of one or more line segments. You can create such a line by specifying the end points of each segment. In your case you have a connection between two shapes which means that you have a one start point and one end point and it is expected for the connection to be straight (you have a single line segment). If you want your line not to be straight you can define more end points in your Connection's ConnectionPoints collection. Here is an example in code:
    xConnection.ConnectionPoints.Add(new Point(220, 90));
    xConnection.ConnectionPoints.Add(new Point(220, 240));

    However, you can automatically route (without using the ConnectionPoints collection) the connections so that they won't cross each other. You can do this when you set the ConnectionType of the connection to Polyline and set the Diagram RouteConnections property to True.

    Also you can take a look at the Types section in the Connections help article where you can find more information about the connection types and how they are used.


    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. DevCraft banner
Back to Top