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

2 posts, 0 answers
  1. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 11 Mar 2015 Link to this post

    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
  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 16 Mar 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top