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

Detect moved shape from container to diagram

1 Answer 44 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 2
Michael asked on 16 Dec 2016, 09:03 PM

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!

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 21 Dec 2016, 07:30 AM
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.
Tags
Diagram
Asked by
Michael
Top achievements
Rank 2
Answers by
Martin Ivanov
Telerik team
Share this question
or