We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

drag/drop

Is anything unique about using drag/drop with a diagram? I would like to create a simple palette from which I can drag symbols to a diagram. I set the AllowDrop property of my diagram to true and register the drag event handlers, but am not getting drag events.

4 Replies

AD Administrator Syncfusion Team March 23, 2004 04:59 PM UTC

Hi Wes, The Diagram control has built in support for drag & drop of Symbol types, and the current implementation does not permeate the drag/drop events. When dragging a Symbol type, the data object that the Diagram control looks for is the Symbol''s NodesCollection value, and starting a drag-drop operatino using the symbol''s NodesCollection as the data object will ensure that the diagram control handles the dragover/dragdrop events for you. However, it is not necessary that you implement this yourself as the recommended approach would be to create a Symbol PaletteGroupBar/PaletteGroupView control and add your symbols to that PaletteGroupView control. Drag/drop from the symbol palette is built into the framework and the method is illustrated in the DiagramBuilder sampl In forthcoming releases of Essential Diagram, we will also revise the Diagram control implementation to generate the requisite drag/drop events as well to enable greater customization of the drag-drop behavior. Prakash Syncfusion, Inc


TL Truman Lackey October 21, 2004 07:57 PM UTC

I have sublcassed the GroupBar control to contain a TreeView. In the TreeView I have a new Node class of PaletteNode that has a symbol model in it. In vb .net my ItemDrag event code for the TreeView is Dim sModel as SymbolModel = e.Item.Model if e.Button = MouseButtons.Left then DoDragDrop(sModel.nodes, DragDropEffects.Copy) end if As per the prevoius post the Diagram DragDrop is looking for a nodes collection. The drag and drop does work but on the drop I am getting a BitMapNode. I am checking this in the Diagram.Model.ChildrenChanging event handler using the evtArgs.Node in the handler with the ChangeType equal to Insert. The project I am working on requires a TreeView type of palette. Is the nodes collection that I am sending the right one? Or do I need to build a special nodes collection for the drag and drop to work correctly? Any help would be appreciated. Thanks.


TL Truman Lackey October 21, 2004 08:21 PM UTC

I did some looking at my code and I was sending the SymbolModel.nodes. I have now created a Symbol using SymbolModel.CreateSymbol() and I am now using its nodes. In the ChildrenChanging event the evtArgs.Node is the BitMapNode so I am having to get it''s parent node to get the the Symbol that was dropped. When I was using a paletteGroupBar the evtArgs.node was a Diagram.Symbol and I did not have to use the parent to get it. Any further suggestions if this is not the correct way to do this would be appreciated. Thanks Truman


AD Administrator Syncfusion Team October 22, 2004 11:22 AM UTC

Hi Truman, Have you taken a look at the following Essential Diagram Knowledgebase Article: How can I implement drag and drop from other controls on to the Diagram? The sample included demnstrates how you can drag and drop from other controls on to the Diagram. This should give you an idea to do what you are seeking. If you have any further questions, can you post a small sample of what you are trying to do. Regards Arun

Loader.
Up arrow icon