Layout after Button adding new node

Hi,

In the Entity Relationship sample I added a button to that when clicked will Add a node and Link that node to an existing node. I also Added a button to run a diagram re-layout when pressed. When I add the node and link it does not show up in the diagram. However, when I then press the Re-Layout button and execute a layout diagram the node shows up.

What I really would like to do is show the new node and link without redrawing the diagram layout. If I could have the node move close to the node being linked to would be even better.

The following xaml shows how I setup ConditionFlags.

Thank
Rich

       <go:Diagram.Layout >
            <golayout:ForceDirectedLayout  
                ConditionFlags="NodeAdded LinkAdded"
                DefaultElectricalCharge="40" 
                DefaultSpringLength="10" 
                MaxIterations="500"/>
        </go:Diagram.Layout>

How did you add the node and link in code? Do you always make all model changes within a StartTransaction/CommitTransaction? If you do, the layout will be performed automatically if needed, as determined by the Conditions flags.

You might also want to look at the IncrementalTree sample in version 0.6.

Actually, the StateChart sample does what you want too (i.e. button that creates a node and a new link to it). Except that its Diagram.Layout isn’t defined, so it assigns the new node’s Location explicitly.