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

Connections to shapes with only 'Auto' connector are not drawn

1 Answer 86 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 11 Mar 2015, 03:03 PM
Migrating from Telerik UI for WPF 4.0 2014.3.1021 to 2015.1.225.40 I've found the following issue.

A requirement of the project I'm working on is that some shapes must have only the 'Auto' connector (others are programmatically removed as below):

var connectorsToBeRemoved = shape.Connectors.Where(x => x.Name != "Auto").ToList();
 
foreach (var connector in connectorsToBeRemoved)
{
    shape.Connectors.Remove(connector);
}

Connecting an arc from any shape to this kind of shape the connection EndPoint is equals to StartPoint, so the connection is not visible.
Adding a fake connector solves the issue, but of course is a workaround:

private static void WorkaroundTelerik2015Q1(RadDiagramShape shape)
{
    var fakeConnector = new RadDiagramConnector {Offset = shape.Connectors[0].Offset, Name = "Fake", IsEnabled = false,};
    shape.Connectors.Add(fakeConnector);
 
    Canvas.SetZIndex(fakeConnector, -999);
}

Another workaround - not viable for me because of existing saved diagrams - is to rename the 'Auto' connector to something else.

Is there a better solution?
Is this the desired behavior or is it a bug?

Thank you for your time.

Regards, 


Manuel

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 16 Mar 2015, 08:05 AM
Hello Manuel,

Thank you for the code-snippets provided. I would able to reproduce the described behavior.

Please have in mind that the internal logic of the auto-connector depends on the four additional connectors, if you remove one or more of these connectors it will lead to issues if attaching to the auto-connector. (as you can read in our help topic Custom Connectors). However, we can suggest you another approach - to hide connectors instead to removing them:
var connectorsToBeRemoved = shape.Connectors.Where(x => x.Name != "Auto").ToList();
 
foreach (var connector in connectorsToBeRemoved)
{
        (connector as RadDiagramConnector).Visibility = System.Windows.Visibility.Hidden;
}

Please give this approach a try and let us know if it works for you.

Regards,
Milena
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Diagram
Asked by
Manuel
Top achievements
Rank 1
Answers by
Milena
Telerik team
Share this question
or