Hi,
<Rectangle go:SpotPanel.Spot=“MiddleRight” Width=“8” Height=“8” Fill=“Black”
go:Node.PortId=“outPort” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“5”
go:Node.FromSpot=“MiddleRight” Cursor=“Hand” />
</go:SpotPanel>
</DataTemplate>
Hi,
<Rectangle go:SpotPanel.Spot=“MiddleRight” Width=“8” Height=“8” Fill=“Black”
go:Node.PortId=“outPort” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“5”
go:Node.FromSpot=“MiddleRight” Cursor=“Hand” />
</go:SpotPanel>
</DataTemplate>
Perhaps the Location is correct. If you save it, what Location does it have?
If the Location hasn’t changed, it’s probably because the Diagram positioned the contents to be at the top-left corner of the panel. Specify values for the Diagram.HorizontalContentAlignment and VerticalContentAlignment attributes.
When saved, it has location as Location=“202 149” in the XML file.
That looks OK to me.
I tried saving and loading a diagram of a single node using the State Chart sample in GoWpfDemo. It worked as you would expect. So I wonder what might be different in your application.
Oh, perhaps you have a Diagram.Layout that is always performing a layout after loading the nodes from XML. In version 1.1 by default you’ll get the behavior that you want. In version 1.0 the easiest solution is not to declare a value in XAML for the Diagram.Layout, but to create it and perform the layout in code only.
My app requires to drag note from palette to the diagram surface to build the diagram, the node needs to stay whereever user drops it, so I made sure there is no Diagram.Layout is set.
What you want is the default behavior. That’s why I don’t understand how your application is different from the samples such as State Chart.
Finally!
Hmmm. It should be OK to set Diagram.InitialStretch if that’s what you want, but it shouldn’t be required to get the (default) behavior that you are seeking. The State Chart sample, for example, doesn’t set InitialStretch.