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

I cannot see my connectors?

3 Answers 190 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 17 Dec 2012, 11:16 AM
I've created a project based on your "OrgChart" sample. I'm trying to modify it so that I can see some connectors on the nodes, but I can't figure it out. Also, I need to add the connectors programmatically. How can I accomplish this?

So far I have this (for the shapes in the diagram toolbox). Not sure if this is right...

var shape = new RadDiagramShape();

shape.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape);

double offset = 0.25;

foreach (var c in connections)

{

    var connector = new RadDiagramConnector() { Name = name };

    connector.Offset = new Point(1.0, offset);

    offset += 0.25;

    shape.Connectors.Add(connector);

}

var galleryItem = new GalleryItem(displayName, shape, category);

gallery.Items.Add(galleryItem);

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 20 Dec 2012, 02:11 PM
Hi Kristoffer,

In the OrgChart sample, we have intentionally hidden the connectors by setting the RadDiagram.IsConnectorsManipulationEnabled property to False. So if you need to display the connectors, you'll have to  set this property back to True in the RadDiagram style.

Also, your code snippet looks correct but as we're not sure what is your exact logic, I'm not sure if it works as you expect it to. However, please note that by default the RadDIagramShape connectors are displayed only when activated - this means that a shape connector is displayed only when a connection will be build from it. In case you need to display the connectors of the shapes at all times, you'll have to edit the default ControlTemplate of the RadDiagramShape to display the connectors container.

I hope this information will help you but if we're missing something, please let me know.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kristoffer
Top achievements
Rank 1
answered on 20 Dec 2012, 02:21 PM
Thanks for your answer,

I do have this in my style: <Setter Property="IsConnectorsManipulationEnabled" Value="True" />

My exact logic is described below. However, I would be happy if I could just get a connector to show up at some time :)

My diagram nodes are generated from code. Each node has an arbitrary number of incoming and outgoing connectors (usually just one). My for-loop attempts to populate the connectors vertically at y-position 0.25, 0.50, 0.75... The code runs, but the connectors are never visible. Do I need to re-add the connection points when the shape is dropped on my diagram surface? (The code I posted does this for the toolbox items.)
0
Pavel R. Pavlov
Telerik team
answered on 26 Dec 2012, 03:37 PM
Hello Kristoffer,

As far as I understand you need to create some connections starting from the same point/connector and ending at some coordinates. This can be achieved by setting the Source property of the RadDiagramConnection to one point of all connections and setting the EndPoint property of the same connection to a Point as shown in the attachment. Please take a look at the attached project and let me know if I have missed something.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Kristoffer
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or