'System.InvalidOperationException' occurred in Telerik.Windows.Controls.Diagrams.dll, The shape has no connectors defined.

2 posts, 0 answers
  1. Robbie
    Robbie avatar
    5 posts
    Member since:
    Mar 2012

    Posted 29 May 2014 Link to this post

    I have a RadDiagramTextShape without connectors.  I don't want to connect to text shapes.

    So I clear then using this line of code:

        ((RadDiagramTextShape)Shape).Connectors.Clear();

    My problem is when a user changes to the Connector Tool ( diagram.ActiveTool = MouseTool.ConnectorTool) and clicks within the RadDiagramTextShape  an unhandled exception is thrown:

    An unhandled exception of type 'System.InvalidOperationException' occurred in Telerik.Windows.Controls.Diagrams.dllAdditional information: The shape has no connectors defined.

    Is there a way to prevent this? 
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 02 Jun 2014 Link to this post

    Hi Robbie,

    When the ActiveTool is the Connector Tool and you click on a shape, the RadDiagram tries to create a connection starting from the nearest connector of the shape. However, in your case this shape does not have a connectors and the diagram deliberately throws an exception - "The Shape has no Connectors".

     If this does not fit in your scenario а possible way to go is to create custom ConnectionTool. You can find a sample implementation in the attached solution. Furthermore, you can explore these help resources:

    Telerik XAML GitHub Repository: Diagram Custom Tools Demo
    RadDiagram Tools Customization

    Regards,
    Petar Mladenov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top