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

Avoid moving shapes outside diagram

7 Answers 64 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
David Navarro
Top achievements
Rank 1
David Navarro asked on 18 Sep 2012, 11:10 AM
Hi,

is there any way to avoid moving shapes outside the diagram or to avoid overlapping shapes?

This could be interesting to design layout editors like floorplants, etc

Best Regards,

David

7 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 21 Sep 2012, 05:55 AM
Hi David Navarro,

 There is the PreviewDrag routed event that is raised when the drag is about to finish, but you can handle that event, thus canceling the action if you calculate that the new position is not correct in terms of application logic (it is outside the viewport or is over other shape...). At the end  the shape will return it's original position. It is very easy to follow pattern but if you need more details, please let us know.  

Greetings,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
David Navarro
Top achievements
Rank 1
answered on 21 Sep 2012, 08:56 AM
Thank you Miro Miroslavov,

Could you give me more details about how to cancel the drag action from the PreviewDrag event?

Greetings,

David
0
Miro Miroslavov
Telerik team
answered on 21 Sep 2012, 11:40 AM
Hello David Navarro,

 I kind of mislead you with my previous post, because the PreviewDrag event is fired at the beginning of the dragging. However I managed to create working example of the mentioned functionality for you using the Drag and PreviewDrag events.
Please have a look at let us know if this is what you need. 

Kind regards,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Miro Miroslavov
Telerik team
answered on 21 Sep 2012, 11:41 AM
Hello David Navarro,

 I kind of mislead you with my previous post, because the PreviewDrag event is fired at the beginning of the dragging. However I managed to create working example of the mentioned functionality for you using the Drag and PreviewDrag events.
Please have a look at let us know if this is what you need. 

Kind regards,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Miro Miroslavov
Telerik team
answered on 21 Sep 2012, 11:41 AM
Hello David Navarro,

 I kind of mislead you with my previous post, because the PreviewDrag event is fired at the beginning of the dragging. However I managed to create working example of the mentioned functionality for you using the Drag and PreviewDrag events.
Please have a look at let us know if this is what you need. 

Kind regards,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Accepted
Miro Miroslavov
Telerik team
answered on 21 Sep 2012, 11:46 AM
Hello David Navarro,

 I kind of mislead you with my previous post, because the PreviewDrag event is fired at the beginning of the dragging. However I managed to create working example of the mentioned functionality for you using the Drag and PreviewDrag events.
Please have a look at let us know if this is what you need. 

Kind regards,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
David Navarro
Top achievements
Rank 1
answered on 21 Sep 2012, 12:48 PM
Thank you very much !!

Regards,

David
Tags
Diagram
Asked by
David Navarro
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
David Navarro
Top achievements
Rank 1
Share this question
or