Positioning of Diagram

Hi Mr. Walter,

Things have become easier since I started using GoXam Silverlight. But there are a few smaller issues that don’t let me breath. Recently I thought of repositioning my chart or you can my diagram. At present when select all my nodes using Ctrl+A and then moves my chart, it brings itself to the center of my drawing board. this is because I have assigned a property HorizontalAlignment to Center. But i dnt want it to align itself. It should stay at some location where it was left. just like we do things using Canvas. so which property will help me prevent alignemnt of my Diagram control to a specific location.

For your information I am using TreeModel and silverlight.


FrameworkElement.HorizontalAlignment specifies where to put the Diagram in the space alloted by the Panel containing the Diagram.

Diagram.HorizontalContentAlignment specifies where to position the diagram contents within the Diagram.Panel, i.e. the viewport.

So you want to set Diagram.HorizontalContentAlignment=“Stretch” and VerticalContentAlignment=“Stretch”.
You can see that many of the samples do this.

Ya i saw there were many samples that were doing the same that i want but when I tried the same on my code it, the chart’s X-Axis almost remains same but it vertically realigns itself to Top.

Here’s the code:

<go:Diagram x:Name="myDiagram" Margin="20" Padding="5" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                            NodeTemplateDictionary="{StaticResource NodeTemplateDictionary}" LinkTemplateDictionary="{StaticResource LinkTemplateDictionary}" 
                            AllowDrop="True" BorderThickness="0" Background="Transparent" ExternalObjectsDropped="myDiagram_ExternalObjectsDropped"/>

You might want to set one of the the Diagram.Initial… properties. There’s a discussion of the properties in the GoXamIntro as well as in the API reference.