GoWPF: Same Palette for different Diagrams

Hi,

I add new diagram as a child of the new tab that is added on button click. I have a palette, which I want to use for all the new Diagram I create.

Whenever I drag-n-drop a node to the diagram nothing happens. I’ve set AllowDrop to true, Model.Modifiable is set to true.

Things were working well when I was using only one diagram.

Is there anything I can do to make this work?

Platform: WPF

Thank you.

I just tried modifying the UpdateDemo sample, which already has two Diagrams in it.

I added a Palette in the XAML, some initialization code to give the palette two nodes, and added AllowDrop=“True” to both of the existing Diagrams. Here’s the initialization code I added:

myPalette.Model = new TestModel() { NodesSource = new List<TestData>() { new TestData() { Key="P1" }, new TestData() { Key="P2" } } };
Everything worked well.

Just in case there was a problem avoided because the two diagrams were sharing the same model, I also changed the second diagram to use its own model. Again, everything worked well.

Are you sure that the Palette.Model is using the same model class as the target Diagram.Model?

Yes I’m using the same Model (GraphModel). And whenever I’m creating new Diagram I’m setting the AllowDrop to true.

Are there any messages in trace listener output? (I.e. the Output window in Visual Studio.)

Is your node data class Serializable? Are all of its fields serializable or declared non-serialized? Does your node data class support cloning?

Solved:

Silly meOuch . By default I had set Diagram to use PanTool. And as known, PanTool doesn't allow you to add nodes to the diagram. Reverted back to the Default Tool, things are working fine.
Appreciate the help. Thank you.

Whether or not the Diagram.PanningTool is enabled or present shouldn’t matter.

But I believe it is true that there needs to be a Diagram.DraggingTool for drag-and-drop to work.