Detect moved shape from container to diagram

2 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Oct 2012

    Posted 16 Dec 2016 Link to this post

    If I move a shape from diagram to a container, i can attach the OnCollectionChanged() in the container to detect the moved shape. But, if I move the shap back to diagram, i dont have method to attach the change event in the diagram control. because the shape is already added in the graphsource, so the AddItem() method isnt invoked.

     

    How can i detect a shape that is moved from container to diagram?

     

    Thanks for a replay!

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1451 posts

    Posted 21 Dec 2016 Link to this post

    Hello Jakob,

    The CollectionChanged event of the container should be invoked also when you move of shape out of it. In other words if you remove it from its children collection.

    Another approach you can try is to subscribe for the dragging events of the diagram. You can do that via the DraggingService of the control or through the PreviewDrag and Drag events. The PreviewDrag event will be fired on start dragging and Drag when the operation is complete. When the drag ends you can check if the shape has parent container.

    Regards,
    Martin
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top