GoXam for WPF v3
Node Class
Members 
Northwoods.GoXam Namespace : Node Class
A Node is a Part to which Links may connect and which may be a member of a Group.
Object Model
Node ClassGroup ClassDiagram ClassSpot StructureLink ClassLayer ClassSpot StructureIDiagramModel InterfaceDiagramPanel ClassSpot Structure
Syntax
[ContentProperty("Content")]
[Localizability(LocalizationCategory.None, Readability=Readability.Unreadable)]
[StyleTypedProperty(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)]
[XmlLangProperty("Language")]
[UsableDuringInitialization(true)]
[RuntimeNameProperty("Name")]
[UidProperty("Uid")]
[TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
[NameScopeProperty("NameScope", System.Windows.NameScope)]
public class Node : Part 
Remarks

Each Node has a Location property. By default this is the same as the Part.Bounds X,Y position. However, you can set the Location property, whereas Part.Bounds is a read-only property.

Furthermore, the "location" need not be the same as the top-left point of the "bounds". Often there is a particular FrameworkElement in the node that is the featured element, and the "location" for the node is actually a point within that element. You can specify which element provides the node's location by setting the LocationElementName property. By default the element name is the empty string, meaning to use the visual element of the node. You can specify which point on that element is the actual location point by setting the LocationSpot property. By default the location spot is TopLeft, meaning the top-left point of the location element. Therefore, the combination of the two default location-specifying properties result in the location of a node to be the top-left point of the bounds of the whole node, the same as the position of the Part.Bounds. But it is moderately common to specify a particular shape or image as the location element name, and it is fairly common to use Spot.Center as the location spot.

The Location property is a CLR property implemented using the LocationProperty attached dependency property on the node's Part.VisualElement. The reason that most of the node "properties" are implemented as attached dependency properties rather than regular CLR properties is that it allows for those property values to be data-bound. It is commonplace to specify the location using a data binding: <DataTemplate x:Key="MyNodeTemplate"> <Border ... go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"> ... </Border> </DataTemplate> This data-binds the node's location with a property on the node data named "Location". Data binding not only keeps FrameworkElement properties in synch with data properties, but also helps support a model-view architecture and undo/redo.

The MinLocation and MaxLocation properties help limit how far a node may be dragged.

The RotationAngle property sets the angle of the node's Part.SelectionElement.

The most common relationship supported by nodes is a node-to-node link relationship. There are a number of properties that return collections of Nodes that a given node is connected with, and there are a number of properties that return collections of Links that a given node connects with to other nodes. These properties are: NodesConnected, NodesInto, NodesOutOf, LinksConnected, LinksInto, and LinksOutOf.

Creating new links is achieved by adding or modifying data in the diagram's model. The precise methods depend on whether the model is an Northwoods.GoXam.Model.ILinksModel or an Northwoods.GoXam.Model.IConnectedModel or an Northwoods.GoXam.Model.ITreeModel.

Nodes also support the ability to provide logical and physical distinctions in the connection points that links use at a node, if the diagram's model supports it. These connections points are called "ports". Some models assume that there is only one port per node. By default that will be the node's Part.VisualElement. However, one can set the PortIdProperty attached property on any visual element to cause that FrameworkElement to be treated as a "port". In the case of a single port for a node, you should set the PortId as an empty string: ... <... ... go:Node.PortId="" ... > ... You can get the FrameworkElement that is the default (single) port using the Port property.

When a node has multiple ports, i.e. multiple FrameworkElements 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 FrameworkElements representing ports using the Ports property. Use the FindPort method to find a particular port element by name. There are also methods for finding the collection of nodes or of links that are connected to a particular port element.

There are also several attached properties that can be set to control how links connect to that FrameworkElement. These include: FromSpotProperty, ToSpotProperty, FromEndSegmentLengthProperty, ToEndSegmentLengthProperty. There are also some attached properties that control whether users may create new links connecting to a port: LinkableFromProperty, LinkableToProperty, LinkableSelfNodeProperty, LinkableDuplicatesProperty, and LinkableMaximumProperty.

Nodes also support the notion of group membership for models that implement Northwoods.GoXam.Model.ISubGraphModel. The ContainingSubGraph property returns the Group that a node is a member of, or null if there is no container group for that node. Changing the group membership of a node requires modifying the diagram's model.

The Node class also supports the notion of expanding and collapsing a subtree starting at a given node. There are two attached properties, IsTreeExpandedProperty and WasTreeExpandedProperty, that can be data-bound, as well as two methods, CollapseTree and ExpandTree.

You may not apply any transforms to a Node; that is reserved to GoXam for future use.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  System.Windows.Controls.ContentPresenter
                     Northwoods.GoXam.Part
                        Northwoods.GoXam.Node
                           Northwoods.GoXam.Adornment
                           Northwoods.GoXam.Group

See Also

Reference

Node Members
Northwoods.GoXam Namespace