I’m evaluating GoXam WPF v1.07 with .NET 3.5 SP1 on VS 2008 SP1, have a question about drag n drop nodes between Palette and Diagram:
OK, it’s good that you have checked that Diagram.AllowDrop is true. Is Diagram.AllowInsert also true? Is Diagram.IsReadOnly false?
Are the IDiagramModel.DataFormat values for both the source Palette and the target Diagram the same? Or are the node data types (IDiagramModel.GetNodeType()) the same?
All double checked: Diagram.AllowDrop=true, Diagram.AllowInsert=true, Diagram.IsReadOnly=false. And both Palette and Diagram’s Model has the same type:
GraphLinksModel<PaletteNodeVM, String, String, PaletteLinkVM>.
Additional info: if I bind the Diagram.Model to the same instance of GraphLinksModel<PaletteNodeVM, String, String, PaletteLinkVM>, both Palette and Diagram shows up the same data based on their own Layout and DateTemplate, but still no drag n drop!
Is your application running with full trust, as a typical desktop application?
(An XBAP running with typical permissions does not support Windows drag-and-drop, so our implementation of drag/drop is limited to one window.)
Are your Diagrams running in separate top-level windows of the same application (AppDomain)?
We’ll investigate.
I just modified an existing application to create a second Window containing a Diagram that was initialized with a new instance of the same kind of model as the main diagram. And I set AllowDrop=true and model.Modifiable=true.
This window/Diagram worked fine as a drag-and-drop target.
Actually, to be more precise, it worked fine until I tried dragging a selection that included links. I wondered why that was, until I noticed a message in the trace listener (the Visual Studio Output window) that it couldn’t add a link data to the model because the LinksSource value wasn’t an IList.
That’s because I had forgotten to initialize the GraphLinksModel.LinksSource collection. Once it had a collection (I used ObservableCollection) everything worked well.
So I suggest you look at the Output window in Visual Studio to see if there are any interesting messages.
Thanks a lot for your help, walter.
I don’t understand what you are asking for.
Do you want to be able to drag from your own Control to a Diagram? If so, and if you want to use the standard drag-and-drop implementation, make sure that the data being transferred is either an instance of the model’s NodeType or an instance of the model’s DataCollection.
If you want to customize the data that is dragged out from a Diagram, override the DraggingTool.DoDragDrop method. The data is normally a new DataObject using the model.DataFormat and the IDataCollection being copied.
yes, I’m trying to drag from my own control to a Diagram.