MouseHover for RadDiagramShape

4 posts, 0 answers
  1. Alaa
    Alaa avatar
    27 posts
    Member since:
    Jun 2014

    Posted 12 Feb 2015 Link to this post

    Hello,
    I have some questions,

    1- How can I control the MouseHover in RadDiagramShape from code behind not from xaml?

    2- How can I keep only one connector for RadDiagramShape?
     I tried 
      MyShape.Connectors.RemoveAt(1);
      MyShape.Connectors.RemoveAt(0);
    It worked 
    Is there no easier way or a way to remove them all? or I can keep the middle one(Center Connector)?

    Thank you.
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 16 Feb 2015 Link to this post

    Hi Alaa,

    Let me get straight to your questions.

    1. There is no MouseOver state of the RadDiagramShape object by default. Could you please be more specific on what exactly you need to customize? Maybe sending me a picture will be enough to understand what your requirement is.

    2. You are on the right way. To achieve your requirement you can control all the connectors of a shape using the RadDiagram.Connectors collection. To clear all the connectors you can invoke the Clear() method of the collection. You can find more information on that matter in our Custom Connectors article.

    On the other hand, I have the feeling that our Gliding Connector feature will be suitable for your second requirement. You can see how this feature behaves in our Class Diagram online demo. Note that the connection is not fixed to any connector. Rather, it always points the shape and moves along if you change the position of the connected shapes. You turn on this feature by setting the RadDiagramShape.UseGlidingConnector property to true. 

    Please try this out and let me know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    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
  4. Alaa
    Alaa avatar
    27 posts
    Member since:
    Jun 2014

    Posted 17 Feb 2015 in reply to Pavel R. Pavlov Link to this post

    Thank you for reply.
    For Q1, I used MouseEnter and MouseLeave, and they worked perfect.
    For Q2:
    - I don't want to remove all the connectors, I need only one and force it to be connected for only one element (only one connection could connects with the connector). How can I do this?
    - For the demo example, it's amazing! Even I didn't know how they hide the connectors! Can you explain it to me?
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 19 Feb 2015 Link to this post

    Hello Alaa,

    I still do not understand your requirements for the MouseOver state. How exactly you need to change the RadDiagramShape? What is the behavior that you need to achieve?

    To achieve your requirement you will need to make 2 customizations to the RadDiagramShape. 1st you need to delete all RadDiagramConnectors that will not be used. 2nd you will need to subscribe to the ConnectionManipulationCompleted event of the RadDiagram. This event is fired whenever a user connects the second end of any RadDiagramConnection to any connector. In that event you will be able to check if the targeted connector is already connected. If there is any other connection you can handle the event and the RadDiagram will delete the connection.

    As for the provided demo, I already explained how that result is achieved. All you need to do is to set the UseGlidingConnector property of the RadDiagramShape to True. This will force the respective shape to have only 1 connector and the connection will behave as demonstrated in the demo.

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    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.

     
Back to Top