Nodes locations from XML

How can i do to set the location’s nodes

from the xml source file ?
For example i edit the file OrgchartEditor.xml like this:
<Employee Key="2" ParentKey="1" Location="400 400" Name="Tony Soprano" Title="Underboss" />
In the xaml file:
go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
But no way that this node take the position (400,400) when the diagramme is loaded.
Thanks.

I think the go:Diagram.Layout value (a TreeLayout) is positioning all of the nodes.

Just remove that property element value and make sure each node that you want to see has a Location point.

it work :-)

thanks

Hi,

there is a way to desactivate/activate programmaticaly this layout ?
I explain,
We want that the diagramme position the new nodes by default, but when the user move some nodes we want this new positions becom persistent (from xml file source),
we like also have the possibility to return to the default positions.
Thanks again.

You need to specify different value(s) for DiagramLayout.Conditions.

Perhaps, in WPF:
<go:TreeLayout Conditions=“InitialOnly” . . . />
or in Silverlight:
<golayout:TreeLayout ConditionFlags=“InitialOnly” . . . />

unfortunly it dont work,

there is my diagramme layout:
<go:Diagram.Layout> <golayout:TreeLayout TreeStyle="LastParents" Arrangement="Horizontal" ConditionFlags="InitialOnly" Angle="90" Alignment="CenterSubtrees" LayerSpacing="35" > <golayout:TreeLayout.AlternateDefaults>

<golayout:TreeVertex Angle=“0” Alignment=“Start”
NodeIndent=“80” NodeSpacing=“10”
PortSpot=“BottomCenter” ChildPortSpot=“MiddleLeft” />
</golayout:TreeLayout.AlternateDefaults>
</golayout:TreeLayout>
</go:Diagram.Layout>

Thanks

That does work for me. There is an initial layout, and afterwards there is no layout even though the user modifies the graph.

However, perhaps you are referring to the layout that occurs when the model’s NodesSource collection is replaced when the user clicks the Load button in that sample. Basically, the PartManager notices when the graph may have changed dramatically, so it calls Diagram.LayoutDiagram, which forces a new layout. That’s typically what people want, but not in your case.

So in the future we’ll add some way to prevent that layout from happening.

For now, you can change the code that loads the new model to temporarily remove the Diagram.Layout:

private void Load_Click(object sender, RoutedEventArgs e) { var model = myDiagram.Model as TreeModel<Employee, int>; if (model == null) return; Northwoods.GoXam.Layout.IDiagramLayout saved = myDiagram.Layout; myDiagram.Layout = null; try { XElement root = XElement.Parse(Demo.MainPage.Instance.SavedXML); model.Load<Employee>(root, "Employee"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } model.IsModified = false; myDiagram.Layout = saved; }

i will use the FlowChart sample, it respond to our needs for the moments,

thanks for your support.