I’m using GoXam for Silverlight 1.2.6.4 (finally!) and am seeing the following odd behavior: when you drag a node from a palette and drop it on the diagram, the node is loaded, unloaded, and then loaded again. This not only seems very strange, but it’s throwing off some of the data binding in the custom control which is in my node template.
To reproduce this issue, I modified the Logic Circuit demo as follows:
- Add a new class, MyControl, which derives from ContentControl.
- In the constructor of MyControl, add handlers for the Loaded and Unloaded events:<span =“apple-style-span”="" style="font-family: Consolas; font-size: 13px; line-height: 18px; white-space: pre; : rgb255, 255, 255; ">[code]Loaded += (sender, args) => { System.Diagnostics.Debug.WriteLine(“Loading {0}”, GetHashCode()); };
Unloaded += (sender, args) => { System.Diagnostics.Debug.WriteLine("----Unloading {0}", GetHashCode());};[/code]
- Modify the OneInOneOut data template so the NodePanel contains both the original path and a MyControl that displays a textblock with some text as its content.
- Run the application and drag a one-in-one-out triangle from the palette and drop it on the diagram. You see a load/unload pair for the object that is dragged from the palette (expected) and then a load/unload/load sequence for the object that actually appears on the diagram. This sequence is not expected.
Is there a way to prevent a new node from being immediately unloaded and reloaded?