Controlling Connection attachment

9 posts, 0 answers
  1. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 25 Jun 2012 Link to this post

    How can I do to control if a connection can be attached to a connector according to its underlying graphsource model ?

    If I noticed that we can take profit from ConnectionManipulationStarted and ConnectionManipulationCompleted events to act on floating connection, I have yet many doubts. 

    - ConnectionManipulationStarted provides way to control the creation of a connection from a connector (Take into account the multiplicity defined by the underlying graphsource model ...).

    - ConnectionManipulationCompleted
    provides way to act on the result of the manipulation. So, for example, if a diagram doesn't allow connection when target shape is null, you can remove it on this event.
    It's a shame that the ConnectionUtilities.DeactivateConnectors is not a public method.

    That being said, these events don't provide mechanism to act before that the connectors on target shape are activated. I like to go to another visual state if the target connector should not be used by the connection.
    ConnectionUtilities lists method such as IsTargetShapeValid or  ActivateNearestConnector.
    Are there any ways to intercept these calls and monitor connector activation ?

    Developing my own connector, I can override the UpdateVisualStates method, but I don't have much information to do something interesting.
    And MouseMove... methods are not always called.

    Is there another way to follow to achieve this?

    Regards,
    Robert
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 27 Jun 2012 Link to this post

    Hello Robert,

    Thank you for sharing your scenario with us. Unfortunately at the moment the RadDiagram doesn't support it but based on your feedback, we decided to log your suggestion as a feature request in our PITS. Basically what we will try to implement is expose an event that will be fired before a connector gets activated so that you can manipulate its state and stop the activation if needed.

    Do you think such an event will allow you to implement your scenario?

    Greetings,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    Hi,

    An event is certainly a solution.
    But, using graphsource, maybe a virtual method CanLink (or CanAttach) will be another relevant solution to check if the proposed target is valid. 

    Thanks for your interest.
    Robert
  5. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 02 Jul 2012 Link to this post

    Hi Robert,

     In this scenarios, you can use the event to command behaviors, or similar. Do you think this will be acceptable in your scenario?

    Greetings,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Hi Alex,

    Could elaborate a bit more on your suggestion as I don't quite see how the command would allow me to control if a connection target is eligible or not? I suppose you are thinking about leveraging the command's CanExcute method.

    Rgds,
    R
  7. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 03 Jul 2012 Link to this post

    Hello,

     Currently, the only way to control this (attaching a connection to a shape) is through the event (ConnectionManipulationCompleted),and more specifically handling the event arguments. With an event to command behavior, you can pass the event args as command parameter to the command. This way, you would not need an additional command.

    Kind regards,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Unfortunatly once the ConnectionManipulationCompleted event is raised, the connector is already attached to the shape.
    We then have no other choice than removing the connector. What we would like to acheive is being able to notify to the user if he can attach to a particular shape or not before ConnectionManipulationCompleted is raised.

    Rgds,
    R
  9. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 03 Jul 2012 Link to this post

    Hello Robert,

     We are aware that with our current events it is not possible to achieve this. This is why, we have logged a feature request for a different event (for example before activating a connector from Tina's update). Once we have implemented this, you would be able to use an event to command behavior and handle the event arguments and thus cancelling the action.

    All the best,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  10. Peter
    Peter avatar
    2 posts
    Member since:
    Jul 2012

    Posted 15 Jul 2012 Link to this post

    I have the same issue:( and this solution will help.
    Thanks
    Peter
Back to Top
UI for WPF is Visual Studio 2017 Ready