Unfortunately at the moment RadDiagram
doesn't provide a very straight-forward approach for customizing the RadDiagramContainerShapes
built-in drop in MVVM. However, we're currently working on this logic and we will do our best to improve and extend it as much as possible.
In the meantime, you can try and implement the approach demonstrated in the attached sample project.
Please note that as I'm not sure what control hosts your source shapes, I defined a sample RadDiagramToolbox
control that displays a default collection of items. And as this default collection is populated with Gallery-related business objects I implemented a custom OnDragInitiaize
handler for the RadDiagramToolbox
. The handler basically takes the dragged object and creates a Model
business object - in my solution this is the business object representing the shapes in the data-bound RadDiagram
(I'm following the setup demonstrated in the SDK sample Pavel pointed you to).
Next, I defined a RadDiagram ItemsChanged
event handler where I basically check whether a Brand
business object is added and if it is, I attach a DragDropManager
event handler for the RadDiagramContainerShape
that represents it. And if a Brand
object is removed, then I detach the event handler of the respective container. I need this operation as I need to implement a custom logic that handles the drop of a new shape on a container.
Finally, I added a RadDiagram OnDrop
event handler to implement custom logic that adds the dragged business data to the RadDiagram GraphSource
in case the drop operation scope is outside a ContainerShape
Please have a look at the solution and let me know if you need any further information or if I'm missing anything from your requirements.
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>