I finnaly have an other issue…
As you can see in this picture, this is my Diagram. Alpha and Teta were created at the beginning and I try to drag Triangle on my diagram.
Alpha and Teta that you can see on the topleft are nodes I find in loop :
foreach (Node node in myDiagram.Nodes)
As you can see, Triangle doesn’t seem to be part of my diagram… Have you an idea why I can’t find it in my loop? What could I forgot? :$
After droping a node on my diagram, I must be able to find it in my diagram nodes, no?
I finally succeded, I had an issue with group but I found a solution :)
However, I still have 2 questions, at first, what should I do to actualize my node template? Because it actually actualize only after clicking on it…
The second one is that if I called my function AddSpotToNodes(); in public MainPage(), my spots are not modified but If I call it after clicking on a button, it works… I don’t understand the difference… MyDiagram already exist at the end of MainPage(), no? :O
The Diagram might exist at the end of the page constructor, but that doesn’t mean all of the Parts do. You might want to do initialization based on geometry and panel layouts in a Diagram.InitialLayoutCompleted event handler.
I still have my issu, I try to find my new spot when the user is dragging the new node on my diagram.
For that I use SelectedPartsChanged but the value of node.ActualHeight is 0…
I don’t understand why? Is it set after the node being drop? If yes, is it a way to force its calculation? :$
If you want to look at the Parts that were dropped, i.e. after the drop, you should use the ExternalObjectsDropped event handler and look at the SelectedParts. At that time the ActualHeight ought not to be zero any more.
Remember that WPF and Silverlight set the ActualHeight after the element has been arranged. That happens “asynchronously”.
I suppose you could override methods of DraggingTool, but you haven’t detailed exactly what you really want to do.