Northwoods.GoSilverlight 1.1.3 Assembly
LayoutManager Class
Members  See Also  Send Feedback
Northwoods.GoXam Namespace : LayoutManager Class

This class is responsible for automatically positioning all nodes in the diagram.

Syntax

Visual Basic (Declaration) 
Public Class LayoutManager 
   Inherits System.Windows.FrameworkElement
C# 
public class LayoutManager : System.Windows.FrameworkElement 

Remarks

You can explicitly re-layout the whole diagram by calling LayoutDiagram. However, it is more common to let this LayoutManager decide when layouts should happen. You can control this by setting the Northwoods.GoXam.Layout.DiagramLayout.Conditions property on each kind of layout. By default each layout has its Northwoods.GoXam.Layout.DiagramLayout.Conditions set to invalidate its layout whenever a node or a link or a group membership is added or removed, but not when a node changes size. Once a Northwoods.GoXam.Layout.DiagramLayout has been invalidated, this LayoutManager will eventually call its Northwoods.GoXam.Layout.IDiagramLayout.DoLayout method.

Each Node and Link has a single Northwoods.GoXam.Layout.IDiagramLayout that may position the node and route the link. The Northwoods.GoXam.Layout.IDiagramLayout is found by proceeding up the chain of containing Groups until it finds one with a value for Group.Layout, or it ultimately uses the diagram's Layout.

The CanLayoutPart predicate decides whether a particular part should be laid out by a given layout. You can set the Part.LayoutId attached property to be the string "None" if you do not want it to be laid out.

Each Diagram has an instance of this class as its LayoutManager property. If you want to customize the standard behavior, you can easily override any of its methods and substitute an instance of your custom layout manager class for your diagram.

            public class CustomLayoutManager : LayoutManager {
              protected override bool CanLayoutPart(Part p, IDiagramLayout lay) {
                return ...;  // decide dynamically which Nodes and Links should be considered for each layout
              }
            }
            
and install it with either XAML:
              <go:Diagram ...>
                <go:Diagram.LayoutManager>
                  <local:CustomLayoutManager />
                </go:Diagram.LayoutManager>
              </go:Diagram>
            
or in the initialization of your Diagram control:
              myDiagram.LayoutManager = new CustomLayoutManager();
            

Automatic layout in GoXam includes support for animated movement of nodes to their intended destinations. Such support is not limited to the execution of PerformLayout -- you can call MoveAnimated at any time. For example, the Node method Node.Move calls MoveAnimated.

Setting the Animated property to false disables all animation. Set the AnimationTime property to control how quickly the animation completes. For nodes that do not have an initial location (because the value is NaN,NaN), you can specify the point from where they appear to come by setting the DefaultLocation.

Although this class inherits from FrameworkElement in order to support data binding, it is not really a FrameworkElement or UIElement! Please ignore all of the properties, methods, and events defined by FrameworkElement and UIElement.

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      System.Windows.UIElement
         System.Windows.FrameworkElement
            Northwoods.GoXam.LayoutManager

See Also