How to set InitialPosition/Stretch?

My diagram always set the first node in the Location of (0,0) although I set positions for all the nodes.

What property should I set to avoid this auto ajustment?
Thanks a lot!

That depends on the values of various Diagram or DiagramPanel properties. I suggest you read the section “Initial Positioning and Scaling” in the GoXamIntro.pdf file, or at Content Alignment and Stretch and Initial Positioning and Scaling.

Thanks walter.

My problem is that I set
InitialPosition="0 0" VerticalContentAlignment="Stretch" HorizentallContentAlignment="Stretch"
It looks fine first. But after I use scrollbar, the diagram automatically adjust all the nodes. I want to disable the auto ajustment after the scrollbar is pressed.
Thanks again!

(I assume you realize you have some typos in the attribute names.)

That’s probably because you don’t have a large enough DiagramPanel.DiagramBounds to cover the whole DiagramPanel’s viewport when the Diagram.InitialPosition is (0,0).

You could just set the DiagramPanel.FixedBounds to a larger value. But this might be inconvenient if the diagram is supposed to automatically grow and shrink.

Or you could set the Diagram.Padding to a bigger value.

Do all DiagramPanel manipulation in a Diagram.TemplateApplied event handler. It’s called when the Diagram.Template has been expanded at which time there should be a DiagramPanel within the visual tree.