LayoutManager
This class is responsible for automatically positioning all nodes in the diagram.
Inherits: FrameworkElement
Constructors
public LayoutManager()
layoutManager = LayoutManager()
The constructor for the standard layout manager that is the initial value of LayoutManager.
Properties
public bool Animated { get; set; }
value = layoutManager.Animated
layoutManager.Animated = value
Gets or sets whether there should be animated motion moving the nodes from their current positions to their laid out positions.
public bool AnimationDisablesDiagram { get; set; }
value = layoutManager.AnimationDisablesDiagram
layoutManager.AnimationDisablesDiagram = value
Gets or sets whether the Diagram is disabled during a layout animation.
public int AnimationTime { get; set; }
value = layoutManager.AnimationTime
layoutManager.AnimationTime = value
Gets or sets the time in milliseconds that any animation should take.
public Point DefaultLocation { get; set; }
value = layoutManager.DefaultLocation
layoutManager.DefaultLocation = value
Gets or sets the location from which unpositioned nodes appear at the start of the animation.
public Diagram Diagram { get; internal set; }
value = layoutManager.Diagram
layoutManager.Diagram = value
Gets the Diagram for which this LayoutManager performs automatic layouts.
public LayoutInitial Initial { get; set; }
value = layoutManager.Initial
layoutManager.Initial = value
Gets or sets under what conditions an "initialization" or "reset" of the model should cause layouts to be invalidated.
public bool SkipsInvalidate { get; set; }
value = layoutManager.SkipsInvalidate
layoutManager.SkipsInvalidate = value
Gets or sets whether LayoutChange) should do nothing when a part is added/removed/changed.
Methods
public virtual bool CanLayoutPart(Part p, IDiagramLayout lay)
result = layoutManager.CanLayoutPart(p, lay)
This predicate decides whether a Part should participate in an IDiagramLayout's layout.
- p
- a Node or Link
- lay
- the layout that might be responsible for positioning the part
Returns: True if the part is visible and if the part's LayoutId is not "None" and is either "All" or the same value as the layout's Id. False for all Adornments and for all Nodes that are IsLinkLabel, and for all Groups that have no Layout.
public virtual void InvalidateLayout(Part p, LayoutChange change)
layoutManager.InvalidateLayout(p, change)
Declare that the IDiagramLayout including a given Part is now invalid and may need to be performed again soon.
- p
- must be a Part
- change
- a hint on the reason for the need for a new layout; this is used to decide whether a layout is really needed.
public virtual void LayoutDiagram(LayoutInitial init, bool immediate)
layoutManager.LayoutDiagram(init, immediate)
Request a re-layout of all invalidated layouts in this diagram.
- init
- If the value is InvalidateAll, all IDiagramLayouts will be declared invalid, and they will all be performed at the time given by the argument. If the value is InvalidateIfNodesUnlocated, IDiagramLayouts will be declared invalid only if they are responsible for Nodes that do not have a Location, because their X and/or Y values are Double.NaN. If the value is ValidateAll, all IDiagramLayouts will be declared valid, and no layout will occur until after something else happens to invalidate a layout. If the value is None, no layout validity is changed -- any invalid layouts will be performed at the specified time.
- immediate
- If true this method performs an immediate layout. If false this method schedules a layout to occur soon.
public void LayoutDiagram()
layoutManager.LayoutDiagram()
Request a re-layout of all of the nodes and links in this diagram.
public void MoveAnimated(Node node, Point newpos)
layoutManager.MoveAnimated(node, newpos)
This basically just sets the value of Position, but with animated movement.
- node
- newpos
- a new position in model coordinates
protected virtual void PerformLayout()
layoutManager.PerformLayout()
This method is called asynchronously in order to layout a Diagram.
Fields
public static readonly DependencyProperty AnimatedProperty
value = LayoutManager.AnimatedProperty
Identifies the Animated dependency property.
public static readonly DependencyProperty AnimationDisablesDiagramProperty
value = LayoutManager.AnimationDisablesDiagramProperty
Identifies the AnimationDisablesDiagram dependency property.
public static readonly DependencyProperty AnimationTimeProperty
value = LayoutManager.AnimationTimeProperty
Identifies the AnimationTime dependency property.
public static readonly DependencyProperty DefaultLocationProperty
value = LayoutManager.DefaultLocationProperty
Identifies the DefaultLocation dependency property.
public static readonly DependencyProperty InitialProperty
value = LayoutManager.InitialProperty
Identifies the Initial dependency property.