Class Node

GoDiagram®
v10.0.11
by Northwoods Software®

A Node is a Part that may connect to other nodes with Links, or that may be a member of a Group.

Group inherits from Node, enabling nodes to logically contain other nodes and links.

Inheritance
Node
Namespace: Northwoods.Go
Assembly: Northwoods.GoDiagram.WinForms.dll
Syntax
public class Node : Part, IHasContextMenu, IHasToolTip
Remarks

For a more general discussion of how to define nodes, see Introduction to Nodes.

Although you can create a Node and Add(Part) it to a Diagram, this does not update the Model. It is more common to create a node by adding a node data object to the model by calling AddNodeData(TNodeData). For example:

myDiagram.StartTransaction("make new node");
myDiagram.Model.AddNodeData(new MyNodeData { Key = "Omega" });
myDiagram.CommitTransaction("make new node");

This will cause a Node or simple Part to be created (copying the template found in NodeTemplateMap), added to the Diagram in some Layer (based on LayerName), and bound to the node data (resulting in Data referring to that node data object). If you do not keep a reference to that object, as the above code does not, you can retrieve it later by calling FindNodeDataForKey(TNodeKey).

It is very common to initialize a Diagram by setting NodeDataSource to a collection of objects holding the properties that you need in your model. Nearly all of the samples do this kind of initialization.

You can delete a Node by either calling Remove(Part) or by calling RemoveNodeData(TNodeData). The latter obviously will modify the Model; the former does so if the Node was created from model data. Commands such as DeleteSelection() call these methods within a transaction.

You can find all of the Links that are connected with a Node by calling FindLinksConnected(string). Because links normally have a direction, you can find all of the links that have their ToNode be a given Node by calling FindLinksInto(string). Similarly, you can call FindLinksOutOf(string) to find all of the links coming out from a node; such links have their FromNode be that node. For tree-structured graphs, use FindTreeChildrenLinks() or FindTreeParentLink().

If you are not so interested in the links but are interested in the nodes at the other end of the links connecting with a node, there are other methods that you can call. FindNodesConnected(string) returns all of the nodes that are at the other end of the links that connect with a given node. FindNodesInto(string) and FindNodesOutOf(string) return the subsets of those nodes considering only those links that go into or come out of the given node. For tree-structured graphs, use FindTreeChildrenNodes() or FindTreeParentNode().

For example, to operate on the data of all of the destination nodes:

var destnodes = somenode.FindNodesOutOf();
foreach (var child in destnodes) {
  if ((child.Data as MyNodeData).Text.Contains("special")) { ... }
}

You can link two nodes by creating a new Link, setting its ToNode and FromNode (in either order), and Add(Part)ing it to the diagram. But it is more common to add a link data object to the Model by calling AddLinkData(TLinkData). Just creating and adding a Link will not update the model.

Thus to add a link when using a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> you should do something like:

myDiagram.StartTransaction("make new link");
(myDiagram.Model as MyModel).AddLinkData(new MyLinkData { From = "Alpha", To = "Beta" });
myDiagram.CommitTransaction("make new link");

Where you would substitute the keys of the actual nodes that you want to connect with a link. If you are using a TreeModel<TNodeData, TNodeKey, TSharedData>, there are no link data objects, so you just need to call SetParentKeyForNodeData(TNodeData, TNodeKey) to specify the "parent" node's key for a "child" node data.

To find a Link given a link data object in the GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort>, call FindLinkForData(object). When using a TreeModel<TNodeData, TNodeKey, TSharedData>, call either FindNodeForData(object) or FindNodeForKey(object) to get a Node, and then call FindTreeParentLink() to get the Link, if any exists.

To find a link that connects two nodes, call FindLinksTo(Node, string, string) or FindLinksBetween(Node, string, string). With the former method, the direction matters; with the latter method it returns links in either direction.

As links connect with a node or are disconnected, you may want to update the appearance of the node. You can set the LinkConnected property to be an Action that is called. These functions must not modify any link relationships -- the properties just exist to update the appearance of the node. A typical usage would be to change the color or figure of a shape.

You can control whether the user may draw a new link or reconnect a link between a pair of Nodes by affecting the result of IsValidLink(Node, GraphObject, Node, GraphObject). You can override that predicate on LinkingTool and RelinkingTool, but it is easier to set the LinkValidation or LinkValidation functional property.

For a more general discussion of validation, see Introduction to Validation.

Nodes also support the ability to provide logical and physical distinctions in the connection points that links use at a node. These connection objects are called "ports". By default the port object will be the whole Node. However, you can set the PortId property on any GraphObject in the visual tree of a node to cause that element to be treated as a "port". The "port id" is just a string that ought to be unique amongst all of the port elements in the node.

In the case of a node only having a single port, you should set the PortId as an empty string. When there is no such element declared as the default port, it uses the whole node. You can use the Port property to get the only port element.

When a node should have multiple ports, i.e. multiple GraphObjects acting as separate connection points for links, you should set each port's PortId to a string value that is unique for the node. When there may be multiple ports on a node, you can get a collection of elements representing ports by using the Ports property. Use the FindPort(string) method to find a particular port element by name.

Note: the only kind of model that can save port information, i.e. portIds that are not an empty string, for links is a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> whose LinkFromPortIdProperty and LinkToPortIdProperty have been set to name properties on the link data objects.

For a more general discussion of ports, see Introduction to Ports.

All of the "FindLinks..." and "FindNodes..." methods mentioned above take an optional port id argument. When no argument is passed, these methods consider all links connecting with the node. When a port id argument is provided, these methods only consider links that connect with that port in the given node. Thus when navigating through the diagram, you can easily look at all of the nodes that links coming out of a given node go to. Or you can just look at those nodes at the ends of links coming out of a particular port.

You can also control the default connecting behavior of Links at each port. Because a port can be any GraphObject, they are all properties on GraphObject. The properties are duplicated so that you can guide the "from" ends of links differently from the "to" ends of links. The properties include:

The "...Spot" and "...Length" properties control the position and routing of links at a port. The "...Linkable..." and "...MaxLinks" properties control whether or not users can draw a new link or reconnect an existing link from or to a port. (The "...Spot" and "...Length" properties also exist on Link, to override for a particular link the default values that come from a port element.)

For a more general discussion of link points, see Introduction to Link Connection Points.

When the graph is tree-structured, you can use several functions for traversing the tree:

Determining whether a tree grows from the root via links that go out to the children or vice-versa is controlled for the whole diagram by the IsTreePathToChildren property. However an individual link will be ignored by the above functions if IsTreeLink is false.

The Node class also supports the notion of expanding and collapsing a subtree of nodes and links, causing those nodes and links to be shown or hidden. Principally this is a matter of setting IsTreeExpanded. Of course if the diagram's graph is not tree-structured, these concepts and properties might not apply.

If you want to change the appearance of the node you can do so in a function that you assign to the TreeExpandedChanged property. This function must not modify any link relationships or expand or collapse any subtrees -- the property just exists to update the appearance of the node.

There is an option for link routing to try to avoid crossing over nodes: Routing = AvoidsNodes. You can control whether such links should avoid or ignore a node by setting Avoidable. Set AvoidableMargin to control the area beyond the ActualBounds where AvoidsNodes links should not go.

For more discussion and examples, see Nodes, Ports, and Link Points.

For more about trees, see Trees, and SubTrees.

To customize user-resizing behavior, please read Introduction to the ResizingTool. To customize user-rotating behavior, please read Introduction to the RotatingTool.

Only Nodes that are in Diagrams can have connections via Links. Templates should not be connected with Links, be labels of Links, be members of Groups, or have any Adornments.

Constructors

Node()

Constructs an empty Node.

Declaration
public Node()
Remarks

The default Panel type is PanelLayoutPosition.

Node(PanelLayout)

Constructs an empty Node. The panel type must be one of the values permitted by Type.

Declaration
public Node(PanelLayout type)
Parameters
Type Name Description
PanelLayout type

if null, the default Panel type is PanelLayoutPosition.

Node(string)

Constructs an empty Node. The panel type can be a string describing one of the built PanelLayout types.

Declaration
public Node(string type)
Parameters
Type Name Description
string type

if the empty string, the default Panel type is PanelLayoutPosition.

Properties

Avoidable

Gets or sets whether this Node is to be avoided by Links whose Routing is AvoidsNodes.

Declaration
public bool Avoidable { get; set; }
Property Value
Type Description
bool
Remarks

The default value is true.

AvoidableMargin

Gets or sets the margin around this Node in which avoidable links will not be routed.

Declaration
public Margin AvoidableMargin { get; set; }
Property Value
Type Description
Margin
Remarks

You may need to increase the FromEndSegmentLength and ToEndSegmentLength in order to prevent link routes from turning within the avoidable area around the Node.

Value must be of type Margin. The default margin is Margin(2,2,2,2)

IsLinkLabel

This read-only property is true when this Node is a label node for a Link.

Declaration
public bool IsLinkLabel { get; }
Property Value
Type Description
bool
Remarks

If this is true, then n.LabeledLink will be a Link and n.LabeledLink.IsLabeledLink will be true.

See Also

IsTreeExpanded

Gets or sets whether the subtree graph starting at this node is expanded.

Declaration
public bool IsTreeExpanded { get; set; }
Property Value
Type Description
bool
Remarks

Changing this property's value will call CollapseTree(int) or ExpandTree(int), and also will call the value of TreeExpandedChanged if it is a function.

The initial value is true -- "tree-child" nodes, and the links to them, are shown.

There is an analogous property for expanded/collapsed Groups: IsSubGraphExpanded.

IsTreeLeaf

Gets whether this node has no tree children.

Declaration
public bool IsTreeLeaf { get; set; }
Property Value
Type Description
bool
Remarks

The initial value is true, meaning that there are no links connected with child nodes in the direction given by IsTreePathToChildren. This value changes automatically as link connections are added to or removed from this node. Links for which IsTreeLink is false are ignored.

Gets or sets the Link for which this Node is acting as a smart label.

Declaration
public Link LabeledLink { get; set; }
Property Value
Type Description
Link

Most nodes do not act as link labels, so this property will be null.

A template should not be a label node for a link.

LinkConnected

Gets or sets the function that is called after a Link has been connected or disconnected with this Node.

Declaration
public Action<Node, Link, GraphObject, bool> LinkConnected { get; set; }
Property Value
Type Description
Action<Node, Link, GraphObject, bool>
Remarks

It is typically used to modify the appearance of the node. The first argument will be this Node. The second argument will be a Link that is now connected with this node. The third argument will be a GraphObject port indicating which port the link was connected with. The fourth argument will be a bool that is true if a Link was connected, and false if a Link was disconnected.

If the value is a function, that function must not modify what this Node is connected with. The Link has already been added -- trying to remove it or another link may produce undefined behavior. However, the other end of the link may not yet have been connected with a node (and might never be), so you cannot depend on looking at what the link connects with.

The default value is null -- no function is called.

LinksConnected

This read-only property returns an iterator over all of the Links that are connected with this node.

Declaration
public IEnumerable<Link> LinksConnected { get; }
Property Value
Type Description
IEnumerable<Link>
Remarks

This includes both links that are coming out of this node as well as links that are going into this node. Setting FromNode or ToNode to refer to this Node will add that Link to this collection.

Use the FindLinksConnected(string), FindLinksOutOf(string), or FindLinksInto(string) methods to get different subsets of the links, depending on direction or depending on connecting to a particular port.

A template should not have any links connected with it.

LinkValidation

Gets or sets a predicate that determines whether or not a Link may be connected with this node.

Declaration
public Func<Node, GraphObject, Node, GraphObject, Link, bool> LinkValidation { get; set; }
Property Value
Type Description
Func<Node, GraphObject, Node, GraphObject, Link, bool>
Remarks

If this is non-null, the predicate is called in addition to the predicate that is LinkValidation on the LinkingTool and RelinkingTool. See IsValidLink(Node, GraphObject, Node, GraphObject) for more details.

The default predicate is null, which is equivalent to simply returning true. The first argument will be the proposed "from" Node (may be null). The second argument will be the proposed "from" GraphObject port (may be null). The third argument will be the proposed "to" Node (may be null). The fourth argument will be the proposed "to" GraphObject port (may be null). The fifth argument may be null when asking about creating a new link, or may be a Link when asking about reconnecting an existing link.

The function, if supplied, must not have any side-effects.

Port

This read-only property returns the primary GraphObject representing a port in this node.

Declaration
public GraphObject Port { get; }
Property Value
Type Description
GraphObject
Remarks

If there is a GraphObject whose PortId is the empty string, return it. If there is no such element, just return this whole Node.

Ports

This read-only property returns an iterator over all of the GraphObjects in this node that act as ports.

Declaration
public IReadOnlyCollection<GraphObject> Ports { get; }
Property Value
Type Description
IReadOnlyCollection<GraphObject>

PortSpreading

Gets or sets how link points are computed when the port spot is a "side" spot.

Declaration
public PortSpreading PortSpreading { get; set; }
Property Value
Type Description
PortSpreading
Remarks

The default value is Evenly.

TreeExpandedChanged

Gets or sets the function that is called when IsTreeExpanded has changed value.

Declaration
public Action<Node> TreeExpandedChanged { get; set; }
Property Value
Type Description
Action<Node>
Remarks

The argument to that function will be this Node.

If the value is a function, that function must not expand or collapse any trees of nodes and links. The Node has already been expanded or collapsed -- trying to change it again may produce undefined behavior.

The default value is null -- no function is called.

WasTreeExpanded

Gets or sets whether the subtree graph starting at this node had been collapsed by a call to ExpandTree(int) on the parent node.

Declaration
public bool WasTreeExpanded { get; set; }
Property Value
Type Description
bool
Remarks

The initial value is false.

See Also

Methods

CollapseTree(int)

Hide each child node and the connecting link, and recursively collapse each child node.

Declaration
public void CollapseTree(int level = 1)
Parameters
Type Name Description
int level

How many levels of the tree, starting at this node, to keep expanded if already expanded; the default is 1, hiding all tree children of this node. Values less than 1 are treated as 1.

Remarks

This changes the value of IsVisible() of the whole subtree and the parts owned by those nodes and links. However, this root node's visibility is unchanged.

Links are assumed to go from the parent node to the children nodes, unless IsTreePathToChildren is false. Links for which IsTreeLink is false are ignored.

This sets IsTreeExpanded to false on this node and on all of the children nodes. For those child nodes that were expanded when they were collapsed, WasTreeExpanded is set to true.

You can also pass in a number of levels to hide nodes beyond a certain level starting at this node. If you want to make sure that all nodes are expanded up to a particular level, call ExpandTree(int). If you want to do both, call ExpandTree before calling CollapseTree to collapse nodes expanded due to the WasTreeExpanded flag.

This method does not perform a transaction or start any animation. You may want to call the CollapseTree(Node) command, which does perform a transaction and raise a DiagramEvent.

To collapse a Group's subgraph of Nodes and Links, use CollapseSubGraph().

See Also

ExpandTree(int)

Show each child node and the connecting link, and perhaps recursively expand their child nodes.

Declaration
public void ExpandTree(int level = 2)
Parameters
Type Name Description
int level

How many levels of the tree should be expanded; the default is 2, showing all tree children of this node and potentially more. Values less than 2 are treated as 2.

Remarks

This may change the value of IsVisible() of the whole subtree and the parts owned by those nodes and links. However, this root node's visibility is unchanged.

This sets IsTreeExpanded to true on this node and on all of the children nodes. Links are assumed to go from the parent node to the children nodes, unless IsTreePathToChildren is false. Links for which IsTreeLink is false are ignored.

This will expand a tree child node only if its WasTreeExpanded property was true.

You can also pass in a number of levels in order to be sure that all nodes starting at this node and up through that number of levels are visible. If you want to make sure that there are no nodes expanded after a particular level, call CollapseTree(int). If you want to do both, call ExpandTree before calling CollapseTree to collapse nodes expanded due to the WasTreeExpanded flag.

This method does not perform a transaction or start any animation. You may want to call the ExpandTree(Node) command, which does perform a transaction and raise a DiagramEvent.

To expand a Group's subgraph of Nodes and Links, use ExpandSubGraph().

See Also

FindCommonTreeParent(Node)

Find the Node that is the perhaps indirect tree parent of both this node and another one, or this node if it is an ancestor of the other node, or vice-versa.

Declaration
public Node FindCommonTreeParent(Node other)
Parameters
Type Name Description
Node other
Returns
Type Description
Node

may be null if in different trees, or may be itself if the OTHER argument is THIS node, or may be itself if the OTHER node is a descendant of THIS node, or may be the OTHER node if THIS node is in the tree of the OTHER node.

Remarks

If you want to find the Group that contains two Parts, call FindCommonContainingGroup(Part).

See Also

FindExternalTreeLinksConnected()

Return a collection of Links that connect with this Node or any in its subtree, excluding any IsTreeLink Links. For trees this is the analog of FindExternalLinksConnected() for Groups.

Declaration
public IEnumerable<Link> FindExternalTreeLinksConnected()
Returns
Type Description
IEnumerable<Link>

FindLinksBetween(Node, string, string)

Returns an iterator over all of the Links that go from this node to another node or vice-versa, perhaps limited to a given port id on this node and a port id on the other node.

Declaration
public IEnumerable<Link> FindLinksBetween(Node othernode, string pid = null, string otherpid = null)
Parameters
Type Name Description
Node othernode
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

string otherpid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Link>
Remarks

If you want all of the links between two nodes in just one direction, use FindLinksTo(Node, string, string).

FindLinksConnected(string)

Returns an iterator over all of the Links that connect with this node in either direction, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Link> FindLinksConnected(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Link>

FindLinksInto(string)

Returns an iterator over all of the Links that go into this node, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Link> FindLinksInto(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Link>

FindLinksOutOf(string)

Returns an iterator over all of the Links that come out of this node, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Link> FindLinksOutOf(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Link>

FindLinksTo(Node, string, string)

Returns an iterator over all of the Links that go from this node to another node, perhaps limited to a given port id on this node and a port id on the other node.

Declaration
public IEnumerable<Link> FindLinksTo(Node othernode, string pid = null, string otherpid = null)
Parameters
Type Name Description
Node othernode
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

string otherpid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Link>
Remarks

If you want all of the links between two nodes in both directions, use FindLinksBetween(Node, string, string).

FindNodesConnected(string)

Returns an iterator over the Nodes that are connected with this node in either direction, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Node> FindNodesConnected(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Node>
Remarks

The results may include this node itself if there is a reflexive link connecting this node with itself.

FindNodesInto(string)

Returns an iterator over the Nodes that are connected with this node by links going into this node, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Node> FindNodesInto(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's PortId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Node>

FindNodesOutOf(string)

Returns an iterator over the Nodes that are connected with this node by links coming out of this node, perhaps limited to the given port id on this node.

Declaration
public IEnumerable<Node> FindNodesOutOf(string pid = null)
Parameters
Type Name Description
string pid

A port identifier string; if null the link's portId is ignored and all links are included in the search.

Returns
Type Description
IEnumerable<Node>

FindPort(string)

Find a GraphObject with a given PortId.

Declaration
public GraphObject FindPort(string pid)
Parameters
Type Name Description
string pid
Returns
Type Description
GraphObject
Remarks

If no such GraphObject is found, search for one with the empty string as its port identifier. Finally, when failing to find a port with either the given name or the empty string, this method returns this whole node itself.

Returns an IEnumerable for the collection of Links that connect with the immediate tree children of this node.

Declaration
public IEnumerable<Link> FindTreeChildrenLinks()
Returns
Type Description
IEnumerable<Link>

Links for which IsTreeLink is false are ignored.

This basically returns either FindLinksOutOf(string) or FindLinksInto(string), depending on IsTreePathToChildren, but the results excludes links for which IsTreeLink is false.

FindTreeChildrenNodes()

Returns an IEnumerable for the collection of Nodes that are the immediate tree children of this node.

Declaration
public IEnumerable<Node> FindTreeChildrenNodes()
Returns
Type Description
IEnumerable<Node>
Remarks

Nodes only connected by links for which IsTreeLink is false are ignored.

This basically returns either FindNodesOutOf(string) or FindNodesInto(string), depending on IsTreePathToChildren.

See Also

FindTreeLevel()

Return how deep this node is in a tree structure.

Declaration
public double FindTreeLevel()
Returns
Type Description
double
Remarks

For tree root nodes, this returns zero. This calls FindTreeParentNode() to find any tree parent node, so this respects IsTreePathToChildren and IsTreeLink to know which way to traverse links and to know to ignore non-tree links.

This may result in undefined behavior if there are cycles of Links that are IsTreeLink.

If you want to know how deep a Part is nested inside Groups, call FindSubGraphLevel().

See Also

FindTreeParentChain()

Return a collection of Parts including this Node, its tree parent link and node, and so on up the chain to the root node.

Declaration
public IEnumerable<Part> FindTreeParentChain()
Returns
Type Description
IEnumerable<Part>

A collection of Nodes and Links.

Remarks

This calls FindTreeParentLink() and FindTreeParentNode(). Links for which IsTreeLink is false are ignored.

This may result in undefined behavior if there are cycles of Links that are IsTreeLink.

The result will include this node and the "root" node and all nodes and links in between. The root node is also accessible directly via FindTreeRoot(). If any of the nodes are Groups, their member parts are not included.

See Also

Returns the Link that connects with the tree parent Node of this node if the graph is tree-structured, if there is such a link and IsTreeLink is true.

Declaration
public Link FindTreeParentLink()
Returns
Type Description
Link

The Link to the parent Node, or null if there is no parent node.

FindTreeParentNode()

Returns the Node that is the tree parent of this node if the graph is tree-structured, if there is a parent.

Declaration
public Node FindTreeParentNode()
Returns
Type Description
Node

The parent Node, or null if there is no parent node.

Remarks

Links for which IsTreeLink is false are ignored.

See Also

FindTreeParts(int)

Return a collection of Parts including this Node, all of the Links going to child Nodes, and all of their tree child nodes and links.

Declaration
public IEnumerable<Part> FindTreeParts(int level = 2147483647)
Parameters
Type Name Description
int level

How many levels of the tree, starting at this node, to include; the default is int.MaxValue, including all tree children of this node. Values less than 1 are treated as 1.

Returns
Type Description
IEnumerable<Part>

A collection of Nodes and Links.

Remarks

Links for which IsTreeLink is false are ignored.

Whether child nodes are found for a parent node by following links out of the parent node or by links coming into the parent node is determined by the value of IsTreePathToChildren.

The result will include this, the "root" node. If any of the nodes are Groups, their member parts are not included.

If you want to find the collection of Parts that are contained by a Group, use FindSubGraphParts().

See Also

FindTreeRoot()

Return the Node that is at the root of the tree that this node is in, perhaps this node itself.

Declaration
public Node FindTreeRoot()
Returns
Type Description
Node

If this Node has no "tree parent", this returns itself.

Remarks

This node will be IsInTreeOf(Node) the resulting node, unless the resulting node is this node itself. The graph traversal will ignore links for which IsTreeLink is false.

If you want to search up the containment hierarchy of Groups, use FindTopLevelPart().

See Also

FindVisibleNode()

Starting with this node, walk up the chain of containingGroups to find a node that is visible.

Declaration
public virtual Node FindVisibleNode()
Returns
Type Description
Node
Remarks

This can be overridden to find a tree-parent/ancestor if the reason that this node is not visible is because of a collapsed tree rather than a collapsed group.

GetAvoidableRect()

Return the area to be avoided for this node -- the node's ActualBounds plus the AvoidableMargin.

Declaration
public Rect GetAvoidableRect()
Returns
Type Description
Rect

the area in document coordinates.

IsInTreeOf(Node)

This predicate is true if this node is a child of the given Node, perhaps indirectly as a descendant.

Declaration
public bool IsInTreeOf(Node node)
Parameters
Type Name Description
Node node

the Node that might be a parent or ancestor of this node.

Returns
Type Description
bool

true if the given node is an ancestor of this node, but false otherwise, including false if it is the same node.

Remarks

If this node is a child of the given node according to IsTreePathToChildren, this returns true. Otherwise this searches recursively the chain of tree parents of this node, ignoring links for which IsTreeLink is false. A node cannot be in its own subtree.

If you what to find out whether this Node is (perhaps indirectly) contained by a Group, use IsMemberOf(Part).

See Also

Implements