GoXam for WPF v3
Diagram Class
Members 
Northwoods.GoXam Namespace : Diagram Class
A Diagram is a Control that includes a DiagramPanel that holds some Layers that display Parts such as Nodes and Links.
Object Model
Diagram ClassClickCreatingTool ClassClickSelectingTool ClassCommandHandler ClassIDiagramTool InterfaceIDiagramTool InterfaceDraggingTool ClassDragSelectingTool ClassDragZoomingTool ClassGridPattern ClassSpot StructureDataTemplateDictionary ClassSpot StructureSpot StructureIDiagramLayout InterfaceLayoutManager ClassLinkingTool ClassLinkReshapingTool ClassDataTemplateDictionary ClassIDiagramModel InterfaceDataTemplateDictionary ClassDiagramPanel ClassPanningTool ClassPartManager ClassPartsModel ClassPrintManager ClassRelinkingTool ClassResizingTool ClassRotatingTool ClassGroup ClassLink ClassNode ClassPart ClassTextEditingTool Class
Syntax
[ContentProperty("InitialParts")]
[TemplatePart(Name="Panel", Type=Northwoods.GoXam.DiagramPanel)]
[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 Diagram : System.Windows.Controls.Control 
Remarks

Each Diagram has a number of standard objects that it uses to perform its duties. These objects are accessible via the following properties: Model, PartManager, LayoutManager, CommandHandler, CurrentTool, DefaultTool, and various other tool properties.

The Model is the object that holds and describes all of the data for which Parts are created and displayed. The purpose of the model is to recognize relationships between the data -- in particular link relationships between nodes and group memberships between nodes. There are different kinds of models, such as Northwoods.GoXam.Model.TreeModel<NodeType,NodeKey>, Northwoods.GoXam.Model.GraphModel<NodeType,NodeKey> and Northwoods.GoXam.Model.GraphLinksModel<NodeType,NodeKey,PortKey,LinkType>.

The default model is a Northwoods.GoXam.Model.UniversalGraphLinksModel. You will typically want to replace it with your own specialized model. The default model does not have an Northwoods.GoXam.Model.UndoManager either; you may want to set Northwoods.GoXam.Model.DiagramModel.HasUndoManager to true.

The PartManager is responsible for creating Nodes corresponding to node data in the model, and for creating Links corresponding to link relationships in the model. It notices the insertion or deletion of node data or link data or group-memberships, and updates the diagram appropriately. It maintains collections of the existing Nodes and Links.

You can control the appearance of the nodes and links in the diagram by setting several data template properties: NodeTemplate, GroupTemplate, LinkTemplate. Also, because this is a standard Control, you can set its Control.Template property to a ControlTemplate. If you do not set these properties, its uses default templates to define the appearance of nodes, links, and of the control itself. If the value of a template property changes, the PartManager will rebuild the Parts that are affected.

You can see the definitions of the standard templates in the Generic.XAML file that is in the docs subdirectory of the GoXam installation.

The diagram also maintains the notion of selected parts. The SelectedParts property is an ObservableCollection of the currently selected Parts. The primary selection is held as the SelectedPart property. You can set MaximumSelectionCount to control how many parts may be selected at once. To select a Part you can set its Part.IsSelected property.

There are many properties, named "Allow...", that control what operations the user may perform on the parts in the diagram. These correspond to the same named properties on Layer that govern the behavior for those parts in a particular layer. Furthermore for some of these properties there are corresponding properties on Part, named "...able", that govern the behavior for that individual part. For example, the AllowCopy property corresponds to Layer.AllowCopy and to the property Part.Copyable. The Part.CanCopy predicate is false if any of these properties is false.

The CommandHandler implements various standard commands, such as the Delete method and the CanDelete predicate. These methods are the implementation of the Commands listed as properties of the Commands static class.

The diagram also keeps track of the mouse-down point and last mouse point, in model coordinates: FirstMousePointInModel and LastMousePointInModel.

The diagram supports modular behavior for mouse events by implementing "tools". "Mode-less" tools are held in three lists: MouseDownTools, MouseMoveTools, and MouseUpTools. The CurrentTool, which defaults to an instance of Northwoods.GoXam.Tool.ToolManager, searches these lists when a mouse event happens to find the first tool that can run. It then makes that tool the new CurrentTool, where it can continue to process mouse events. When the tool is done, it stops itself, causing the DefaultTool to become the new CurrentTool.

Standard tools include:

The diagram also raises various routed events when interesting things happen.

The events include:

The LayoutManager is responsible for positioning all of the Nodes and routing all of the Links. The overall positioning of nodes is done by the value of the Layout property. Some Groups can have their own Group.Layouts.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  System.Windows.Controls.Control
                     Northwoods.GoXam.Diagram
                        Northwoods.GoXam.Overview
                        Northwoods.GoXam.Palette

See Also

Reference

Diagram Members
Northwoods.GoXam Namespace