Avoid moving shapes outside diagram

8 posts, 1 answers
  1. David Navarro
    David Navarro avatar
    3 posts
    Member since:
    Sep 2012

    Posted 18 Sep 2012 Link to this post

    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
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. David Navarro
    David Navarro avatar
    3 posts
    Member since:
    Sep 2012

    Posted 21 Sep 2012 Link to this post

    Thank you Miro Miroslavov,

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

    Greetings,

    David
  5. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2012 Link to this post

    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.

  6. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2012 Link to this post

    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.

  7. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2012 Link to this post

    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.

  8. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2012 Link to this post

    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.

  9. David Navarro
    David Navarro avatar
    3 posts
    Member since:
    Sep 2012

    Posted 21 Sep 2012 Link to this post

    Thank you very much !!

    Regards,

    David
Back to Top
UI for WPF is Visual Studio 2017 Ready