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

MouseHover for RadDiagramShape

3 Answers 146 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Alaa
Top achievements
Rank 1
Alaa asked on 12 Feb 2015, 09:31 AM
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.

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 16 Feb 2015, 01:46 PM
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.

 
0
Alaa
Top achievements
Rank 1
answered on 17 Feb 2015, 08:51 AM
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?
0
Pavel R. Pavlov
Telerik team
answered on 19 Feb 2015, 09:50 AM
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.

 
Tags
Diagram
Asked by
Alaa
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Alaa
Top achievements
Rank 1
Share this question
or