Class Diagram

GoDiagram®
v10.0.11
by Northwoods Software®

A Diagram is associated with a component within your application. Constructing a Diagram creates a the necessary page elements, along with other helpers elements.

Inheritance
Diagram
Namespace: Northwoods.Go
Assembly: Northwoods.GoDiagram.Avalonia.dll
Syntax
public class Diagram : IHasContextMenu, IHasToolTip
Remarks

GoDiagram will manage the contents of this element -- you should not modify the contents of the element, although you may style the given element (background, border, etc) and position and size it as needed.

Each Diagram holds a set of Layers each of which holds some number of Parts such as Nodes and Links. Each Part consists of GraphObjects such as TextBlocks and Shapes and Panels holding yet more GraphObjects.

A Diagram and its Parts provide the visual representation of a Model<TNodeData, TNodeKey, TSharedData> that holds data objects for the nodes and the links. The model provides the way to recognize the relationships between the data.

Two Diagrams can display and manipulate the same Model. (Example)

A diagram will automatically create Nodes and Links corresponding to the model data. The diagram has a number of named templates it uses to create the actual parts: NodeTemplateMap, GroupTemplateMap, and LinkTemplateMap. Each template may have some data Bindings that set the part's GraphObjects' properties based on the value of properties of the data.

A simple Node template and Model data (both nodes and links) may look like this:

// define a simple Node template
myDiagram.NodeTemplate =
  new Node(PanelLayoutAuto.Instance)
    .Add(
      new Shape { Figure = "RoundedRectangle" }
        .Bind("Fill", "Color"),  // Shape.Fill is bound to Node.Data.Color
      new TextBlock { Margin = 3 }  // some room around the text
        .Bind("Text", "Key")  // TextBlock.Text is bound to Node.Data.Key
    );

// create the model data that will be represented by Nodes and Links
myDiagram.Model = new Model {
  NodeDataSource = new List<NodeData> {
    new NodeData { Key = "Alpha", Color = "lightblue" },
    new NodeData { Key = "Beta", Color = "orange" },
    new NodeData { Key = "Gamma", Color = "lightgreen" },
    new NodeData { Key = "Delta", Color = "pink" }
  },
  LinkDataSource = new List<LinkData> {
    new LinkData { From = "Alpha", To = "Beta" },
    new LinkData { From = "Alpha", To = "Gamma" },
    new LinkData { From = "Beta", To = "Beta" },
    new LinkData { From = "Gamma", To = "Delta" },
    new LinkData { From = "Delta", To = "Alpha" }
  }
};

The above code is used to make the Minimal sample, a simple example of creating a Diagram and setting its model.

Read about models on the Using Models page in the introduction.

A diagram is responsible for scrolling (Position) and zooming (Scale) all of the parts that it shows. Each Part occupies some area given by its ActualBounds.

The union of all of the parts' bounds constitutes the DocumentBounds. The document bounds determines the area that the diagram can be scrolled to. There are several properties that you can set, such as InitialContentAlignment, that control the initial size and position of the diagram contents.

At any later time you can also explicitly set the Position and/or Scale to get the appearance that you want. But you may find it easier to call methods to get the desired effect. For example, if you want to make a particular Node be centered in the viewport, call either CenterRect(Rect) or ScrollToRect(Rect) with the Node's ActualBounds, depending on whether or not you want the view to be scrolled if the node is already in view.

Read in the Introduction about Viewports and the Initial Viewport.

You can have the diagram perform automatic layouts of its nodes and links by setting Layout to an instance of the Layout subclass of your choice. The default Layout is an instance of the Layout base class that ignores links and only positions Nodes that do not have a location. This default layout will allow you to programmatically position nodes (including by loading from a database) and will also allow the user to manually position nodes using the DraggingTool.

If you do supply a particular layout as the Layout, you can control which Parts it operates on by setting IsLayoutPositioned. Normally, of course, it works on all top-level nodes and links. The layout is performed both after the model is first loaded as well as after any part is added or removed or changes visibility or size. You can disable the initial layout by setting IsInitial to false. You can disable later automatic layouts by setting IsOngoing to false.

See the Layouts page in the Introduction for a summary of layout behavior.

A diagram maintains a collection of selected parts, the Selection. To select a Part you set its IsSelected property to true.

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 AllowCopy and to the property Copyable. The CanCopy() predicate is false if any of these properties is false.

See the Permissions page for a more thorough discussion.

The CommandHandler implements various standard commands, such as the DeleteSelection() method and the CanDeleteSelection() predicate.

See the Commands page for a listing of keyboard commands and the use of commands in general.

The diagram supports modular behavior for mouse events by implementing "tools". All mouse and keyboard events are represented by InputEvents and redirected to the CurrentTool. The default tool is an instance of ToolManager which keeps three lists of mode-less tools: MouseDownTools, MouseMoveTools, and MouseUpTools. The 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 input events. When the tool is done, it stops itself, causing the DefaultTool to be the new CurrentTool.

Mouse-down tools include:

Mouse-move tools include:

Mouse-up tools include:

You can also run a tool in a modal fashion by explicitly setting CurrentTool. That tool will keep running until some code replaces the CurrentTool. This normally happens when the current tool calls StopTool(), such as on a mouse-up event.

See the Tools page for a listing of predefined tools and how they operate.

A diagram raises various DiagramEvents when interesting things happen that may have affected the whole diagram. See the documentation for DiagramEventName for a complete listing.

When you need to display multiple Models, but not at the same time, you can do so by using only one Diagram and setting the Model to a different one. These scenarios are discussed more on the Replacing Diagrams and Models intro page.

Constructors

Diagram()

Construct an empty Diagram. You will not normally call this constructor.

Declaration
public Diagram()
Remarks

You will normally initialize properties of the Diagram that control its appearance and behavior. These properties include:

Then you will need to construct a Model (usually a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort>) for the Diagram, initialize its data by setting its NodeDataSource and other properties, and then set the diagram's Model.

Properties

AllowClipboard

Gets or sets whether the user may copy to or paste parts from the internal clipboard.

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

This allows use of CutSelection(), CopySelection() and PasteSelection(Point?). The initial value is true.

AllowCopy

Gets or sets whether the user may copy objects.

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

The initial value is true.

AllowDelete

Gets or sets whether the user may delete objects from the Diagram.

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

The initial value is true.

AllowDragOut

Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element.

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

The initial value is false.

AllowDrop

Gets or sets whether the user may end a drag-and-drop operation in this Diagram.

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

This is typically set to true when a Diagram is used with a Palette.

The initial value is true.

AllowGroup

Gets or sets whether the user may group parts together.

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

The initial value is true.

AllowHorizontalScroll

Gets or sets whether the user is allowed to use the horizontal scrollbar.

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

The initial value is true.

See Also

AllowInsert

Gets or sets whether the user may add parts to the Diagram.

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

The initial value is true.

Gets or sets whether the user may draw new links.

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

The initial value is true.

AllowMove

Gets or sets whether the user may move objects.

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

The initial value is true.

Gets or sets whether the user may reconnect existing links.

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

The initial value is true.

AllowReshape

Gets or sets whether the user may reshape parts.

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

The initial value is true.

AllowResize

Gets or sets whether the user may resize parts.

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

The initial value is true.

AllowRotate

Gets or sets whether the user may rotate parts.

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

The initial value is true.

AllowSelect

Gets or sets whether the user may select objects.

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

The initial value is true.

AllowTextEdit

Gets or sets whether the user may do in-place text editing.

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

The initial value is true.

AllowUndo

Gets or sets whether the user may undo or redo any changes.

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

The initial value is true.

AllowUngroup

Gets or sets whether the user may ungroup existing groups.

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

The initial value is true.

AllowVerticalScroll

Gets or sets whether the user is allowed to use the vertical scrollbar.

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

The initial value is true.

See Also

AllowZoom

Gets or sets whether the user may zoom into or out of the Diagram.

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

The initial value is true.

AnimationManager

This read-only property returns the AnimationManager for this Diagram.

Declaration
public AnimationManager AnimationManager { get; }
Property Value
Type Description
AnimationManager

AutoScale

Gets or sets the auto scale behavior of the Diagram, controlling whether or not the Diagram's bounds automatically scale to fit the view.

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

The only accepted values are None, Uniform, or UniformToFill. Setting this will change the Diagram's Scale and Position, if appropriate.

The default value is None - the scale and position are not automatically adjusted according to the area covered by the document. When the value is not None, any value for InitialAutoScale or InitialScale is ignored.

When AutoScale is set to a non-None value, the user will not be able to zoom, and setting Scale will do nothing. If you only want to scale automatically on initialization, use InitialAutoScale.

Setting this property to Uniform is basically the same as calling ZoomToFit() all the time, or just disabling interactive zooming.

Note that depending on the values of MaxScale and MinScale, the actual value for Scale might be limited.

AutoScrollInterval

Gets or sets number of milliseconds between autoscroll events.

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

The default value is 250.

AutoScrollRegion

Gets or sets the Margin that describes the area along the inside edges of the viewport, in viewport coordinates, where autoscrolling will occur while the mouse (pointer) is held there during dragging or linking or drag-selecting.

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

The default value is a Margin of 16 on all sides. Increase this value in order to make it easier for the user to autoscroll by having a larger area in which to hold the mouse (pointer) down during a dragging operation.

When the mouse (pointer) drag point is within this region on the left or right sides, the view will automatically scroll horizontally in that direction. When the point is within the region on the top or bottom, the view will automatically scroll vertically in that direction. You can specify a Margin side of zero to disable autoscrolling in a particular direction; a value of Margin(0,0,0,0) turns off autoscrolling in all four directions.

Click

Gets or sets the function to execute when the user single-primary-clicks on the background of the Diagram.

Declaration
public Action<InputEvent> Click { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundSingleClicked".

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

CommandHandler

Gets or sets the CommandHandler for this Diagram.

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

This is set to a new instance of CommandHandler on Diagram instantiation.

Setting this property does not notify about any changed event. The value cannot be null and must not be shared with other Diagrams.

ContentAlignment

Gets or sets the content alignment Spot of this Diagram, to be used in determining how parts are positioned when the ViewportBounds width or height is larger than the DocumentBounds.

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

For instance a spot of Center would ensure that the Diagram's contents are always centered in the viewport.

If you want the content to be aligned only initially, use InitialContentAlignment instead.

The default value is Default, which causes no automatic scrolling or positioning. When the value is not Default, any value for InitialContentAlignment or InitialPosition is ignored.

Setting this property has the same effect as implementing a "LayoutCompleted" DiagramEvent listener that scrolls the viewport to align the content.

ContextClick

Gets or sets the function to execute when the user single-secondary-clicks on the background of the Diagram.

Declaration
public Action<InputEvent> ContextClick { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the right (secondary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundContextClicked".

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

ContextMenu

This context menu is shown when the user context clicks in the background. This value is typically an Adornment, which implements IShowHidable.

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

The default value is null, which means no context menu is shown.

On touch devices, the DefaultTouchContextMenu will appear even there is no context menu defined.

myDiagram.ContextMenu =
  Builder.Make<Adornment>("ContextMenu")
    .Add(
      Builder.Make<Panel>("ContextMenuButton")
        .Add(new TextBlock("Undo"))
        .Set(new { Click = new Action<InputEvent, GraphObject>((e, obj) => { e.Diagram.CommandHandler.Undo(); }) })
        .Bind(
          new Binding("Visible", "", (o, _) => {
            return (o as GraphObject).Diagram?.CommandHandler.CanUndo();
          }).OfElement()
        ),
      Builder.Make<Panel>("ContextMenuButton")
        .Add(new TextBlock("Redo"))
        .Set(new { Click = new Action<InputEvent, GraphObject>((e, obj) => { e.Diagram.CommandHandler.Redo(); }) })
        .Bind(
          new Binding("Visible", "", (o, _) => {
            return (o as GraphObject).Diagram?.CommandHandler.CanRedo();
          }).OfElement()
        )
    );
See Also

CurrentCursor

Gets or sets the current cursor for the Diagram, overriding the DefaultCursor.

Setting this property does not notify about any changed event. Setting this value to the empty string ("") returns the Diagram's cursor to the DefaultCursor.

Declaration
public string CurrentCursor { get; set; }
Property Value
Type Description
string
See Also

CurrentTool

Gets or sets the current tool for this Diagram that handles all input events.

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

This value is frequently replaced by the ToolManager as different tools run.

Each Diagram has a number of tools that define its behavior when responding to mouse events. These include ClickSelectingTool, DraggingTool, DragSelectingTool, LinkingTool, and ResizingTool, among others.

Initially this is set to the value of DefaultTool. Setting this to a null value is treated as if it were set to the DefaultTool, because there should always be a currently running tool, except when the diagram is being initialized.

A ToolManager is the default tool used by a Diagram - it chooses to run one of the other tools depending on the circumstances.

Setting this property to a new tool stops the previous current tool

Setting this property does not notify about any changed event.

See Also

Debug

Gets or sets whether debug mode is active.

Debug mode does more error checking of property values and method arguments, and it detects more unusual situations. Most warnings and errors will be written to the console/output window. Always check it for messages. We have tried to make them informative.

Declaration
public static bool Debug { get; set; }
Property Value
Type Description
bool

DefaultCursor

Gets or sets the cursor to be used for the Diagram when no GraphObject specifies a different cursor.

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

Valid CSS cursors are accepted, such as "auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", etc.

It is possible to use custom cursors with the syntax "url(path_to_image), default". A fallback (like default here) is necessary for a custom cursor to work.

To read more about cursor syntax, go to: CSS cursors (mozilla.Org). The default value is "auto".

See Also

DefaultScale

Gets or sets the Scale set by ResetZoom(double) and when computing stretch values, such as when AutoScale or InitialAutoScale are set, or when ZoomToFit() is called.

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

The default value is 1.0. The value must be a number larger than 0. Setting this property does not raise any events.

DefaultTool

Gets or sets the default tool for this Diagram that becomes the current tool when the current tool stops.

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

Initially this value is the same tool as ToolManager, which is an instance of ToolManager.

Setting this property also sets the CurrentTool if the old default tool is the currently running tool.

Setting this property does not notify about any changed event. The value cannot be null and must not be shared with other Diagrams.

See Also

DocumentBounds

This read-only property returns the bounds of the diagram's contents, in document coordinates.

Declaration
public Rect DocumentBounds { get; }
Property Value
Type Description
Rect
Remarks

This is normally computed and set by ComputeBounds() during Diagram updates that can occur for any number of relevant reasons, such as a Part changing size.

The Diagram's DocumentBounds can have an unvarying specific value by setting the FixedBounds property.

If the DocumentBounds are larger than the ViewportBounds, scrollbars will appear on desktop browsers. You can disable scrolling with the AllowHorizontalScroll and AllowVerticalScroll properties, and you can disable scrollbars themselves with the HasHorizontalScrollbar and HasVerticalScrollbar properties.

DoubleClick

Gets or sets the function to execute when the user double-primary-clicks on the background of the Diagram.

Declaration
public Action<InputEvent> DoubleClick { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This typically involves a mouse-down/up/down/up in rapid succession at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundDoubleClicked".

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

FirstInput

Gets or sets the most recent mouse-down InputEvent that occurred.

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

Setting this property does not notify about any changed event.

See Also

FixedBounds

Gets or sets a fixed bounding rectangle to be returned by DocumentBounds and ComputeBounds().

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

By default this has NaN values, meaning that ComputeBounds() will compute the union of all of the parts in the Diagram to determine the DocumentBounds. If all x/y/width/height values are real numbers, this value is used as the DocumentBounds.

Grid

Gets or sets a Panel of type PanelLayoutGrid acting as the background grid extending across the whole viewport of this diagram.

Declaration
public Panel Grid { get; set; }
Property Value
Type Description
Panel

GroupSelectionAdornmentTemplate

Gets or sets the default selection Adornment template, used to adorn selected Groups.

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

Each Group can have its own SelectionAdornmentTemplate, which if non-null will take precedence over this Diagram property.

This Adornment must not be in the visual tree of any Diagram.

GroupTemplate

Gets or sets the default Group template used as the archetype for group data that is added to the Model.

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

Setting this property just modifies the GroupTemplateMap by replacing the entry named with the empty string. The value must not be null and must be a Group, not a Node or simple Part. This Part must not be in the visual tree of any Diagram.

GroupTemplateMap

Gets or sets a dictionary mapping template names to Groups.

Declaration
public IDictionary<string, Group> GroupTemplateMap { get; set; }
Property Value
Type Description
IDictionary<string, Group>
Remarks

These groups are copied for each group data that is added to the Model.

The new value must not be null, nor may it contain a Node or Link or simple Part. The Links must not be in the visual tree of any Diagram. Replacing this Map will automatically call RebuildParts().

If you modify this dictionary, by replacing a Group in it or by adding or removing a map entry, you need to explicitly call RebuildParts() afterwards.

HandlesDragDropForTopLevelParts

Gets or sets whether drag-and-drop events may be bubbled up to the diagram if not handled by a part.

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

The default value is false -- each Node or Link that in the diagram needs to define its own MouseDragEnter, MouseDragLeave, and MouseDrop event handlers if you want dragging/dropping on a part to act as if the user were acting on the diagram.

If set to true, this will call MouseDragOver during a drag, even while dragging over top-level parts, and MouseDrop will be called even when dropping onto parts.

This property will have no impact while dropping on a Group. The Group's mouseDrop and HandlesDragDropForMembers should be set if desired.

GraphObjects do not have a MouseDragOver property, so if this is set to true, the Diagram's MouseDragOver will always be called, even when dragging over a part.

See Also

HasHorizontalScrollbar

Gets or sets whether the Diagram has a horizontal scrollbar.

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

To enable or disable scrolling itself, use AllowHorizontalScroll and AllowVerticalScroll.

Adding or removing a scrollbar modifies the diagram's viewport.

The initial value is true.

See Also

HasVerticalScrollbar

Gets or sets whether the Diagram has a vertical scrollbar.

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

To enable or disable scrolling itself, use AllowHorizontalScroll and AllowVerticalScroll.

Adding or removing a scrollbar modifies the diagram's viewport.

The initial value is true.

See Also

Highlighteds

This read-only property returns the read-only collection of highlighted parts.

Declaration
public IReadOnlyCollection<Part> Highlighteds { get; }
Property Value
Type Description
IReadOnlyCollection<Part>
Remarks

Do not modify this collection. If you want to highlight or remove the highlight for a particular Part in a Diagram, set the IsHighlighted property. If you want to highlight a collection of Parts, call Highlight(IEnumerable<Part>). If you want to removal all highlights and highlight a single object, call Highlight(Part). If you want to remove all highlights, call ClearHighlighteds().

Note that Highlighteds collection and IsHighlighted property are completely independent of the Selection collection and the IsSelected property. No predefined command or tool operates on this highlighteds collection.

InitialAutoScale

Gets or sets how the scale of the diagram is automatically set at the time of the "InitialLayoutCompleted" DiagramEvent, after the model has been replaced.

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

The only accepted values are None, Uniform, or UniformToFill. Setting this will change the Diagram's Scale and Position, if appropriate.

If you want to always automatically scale the Diagram, set AutoScale instead. If you want to set the scale to a specific value on initialization (each time the model is replaced), set InitialScale.

The default value is None -- the scale and position are not automatically adjusted according to the area covered by the document.

Setting this property to Uniform is basically the same as calling ZoomToFit() in an "InitialLayoutCompleted" DiagramEvent listener.

Note that depending on the values of MaxScale and MinScale, the actual value for Scale might be limited.

InitialContentAlignment

Gets or sets the initial content alignment Spot of this Diagram, to be used in determining how parts are positioned initially relative to the viewport, when the ViewportBounds width or height is smaller than the DocumentBounds.

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

For instance a spot of Center would ensure that the Diagram's contents are initially centered in the viewport.

To initially align the document when the documentBounds are larger than the viewport, use InitialDocumentSpot and InitialViewportSpot.

If you want the content to be constantly aligned with a spot, use ContentAlignment instead.

The default value is Default, which causes no automatic scrolling or positioning.

Setting this property has the same effect as implementing an "InitialLayoutCompleted" DiagramEvent listener that scrolls the viewport to align the content.

See Also

InitialDocumentSpot

Gets or sets the spot in the document's area that should be coincident with the InitialViewportSpot of the viewport when the document is first initialized.

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

The default value is TopLeft.

If you set this, often you will also want to set InitialViewportSpot. If you set InitialPosition, it will take precedence over this property.

Setting this property and InitialViewportSpot has the same effect as implementing an "InitialLayoutCompleted" DiagramEvent listener that calls AlignDocument(Spot, Spot).

See Also

InitialPosition

Gets or sets the initial coordinates of this Diagram in the viewport, eventually setting the Position.

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

This value is relevant on initialization of a Model or if DelayInitialization(Action<Diagram>) is called. Value must be of type Point in document coordinates. The default is Point(double.NaN, double.NaN).

Setting this property has the same effect as implementing an "InitialLayoutCompleted" DiagramEvent listener that sets Position.

Setting this property does not notify about any changed event.

See Also

InitialScale

Gets or sets the initial scale of this Diagram in the viewport, eventually setting the Scale.

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

This value is relevant on initialization of a Model or if DelayInitialization(Action<Diagram>) is called. The default is NaN.

Setting this property has the same effect as implementing an "InitialLayoutCompleted" DiagramEvent listener that sets Scale.

InitialViewportSpot

Gets or sets the spot in the viewport that should be coincident with the InitialDocumentSpot of the document when the document is first initialized.

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

The default value is TopLeft.

If you set this, often you will also want to set InitialDocumentSpot. If you set InitialPosition, it will take precedence over this property.

Setting this property and InitialDocumentSpot has the same effect as implementing an "InitialLayoutCompleted" DiagramEvent listener that calls AlignDocument(Spot, Spot).

See Also

IsEnabled

Gets or sets whether the user may interact with the Diagram.

Declaration
public bool IsEnabled { get; set; }
Property Value
Type Description
bool
See Also

IsModelReadOnly

Gets or sets whether the Diagram's Model is IsReadOnly.

Declaration
public bool IsModelReadOnly { get; set; }
Property Value
Type Description
bool
See Also

IsModified

Gets or sets whether this Diagram's state has been modified.

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

Setting this property does not notify about any changed event, but it does raise the "Modified" DiagramEvent, although perhaps not immediately.

Returns true if the Diagram has been changed, if the UndoManager has recorded any changes, or if an undo has been performed without a corresponding redo.

Replacing the Model<TNodeData, TNodeKey, TSharedData> automatically sets this property to false after the initial layout has completed. The "Modified" DiagramEvent is also raised when an undo or a redo has finished. A "Modified" DiagramEvent listener must not modify this Diagram or its Model.

IsMouseCaptured

Gets or sets whether mouse events initiated within the Diagram will be captured.

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

The initial value is true. Setting this property does not notify about any changed event.

IsReadOnly

Gets or sets whether the Diagram may be modified by the user, while still allowing the user to scroll, zoom, and select.

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

The initial value is false.

See Also

IsTreePathToChildren

Gets or sets whether the Diagram tree structure is defined by links going from the parent node to their children, or vice-versa.

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

By default this property is true: links go from the parent node to the child node.

LastInput

Gets or sets the last InputEvent that occurred.

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

This property is useful in tools and real-time operations for determining where the mouse pointer was most recently located.

Setting this property does not notify about any changed event.

See Also

Layers

This read-only property returns an iterator for this Diagram's Layers.

Declaration
public IEnumerable<Layer> Layers { get; }
Property Value
Type Description
IEnumerable<Layer>
See Also

Layout

Gets or sets the Layout used to position all of the top-level nodes and links in this Diagram.

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

By default this property is an instance of a simple Layout that assigns positions to all parts that need it. The value cannot be null and must not be shared with other Diagrams.

LicenseKey

This static/shared property holds the runtime license key that permits distribution of applications using this control without displaying a licensing watermark.

Declaration
public static string LicenseKey { get; set; }
Property Value
Type Description
string
Remarks

This should always be set before any Diagram is created.

For more details, read the intro documentation.

This read-only property returns a read-only collection of all Links in the Diagram.

This includes both data-bound and unbound links, and both top-level links and links inside Groups.

Declaration
public IReadOnlyCollection<Link> Links { get; }
Property Value
Type Description
IReadOnlyCollection<Link>

LinkSelectionAdornmentTemplate

Gets or sets the default selection Adornment template, used to adorn selected Links.

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

Each Link can have its own SelectionAdornmentTemplate, which if non-null will take precedence over this Diagram property.

This Adornment must not be in the visual tree of any Diagram.

LinkTemplate

Gets or sets the default Link template used as the archetype for link data that is added to the Model.

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

Setting this property just modifies the LinkTemplateMap by replacing the entry named with the empty string. The value must not be null and must be a Link, not a Node or simple Part. This Link must not be in the visual tree of any Diagram.

LinkTemplateMap

Gets or sets a dictionary mapping template names to Links.

Declaration
public IDictionary<string, Link> LinkTemplateMap { get; set; }
Property Value
Type Description
IDictionary<string, Link>
Remarks

These links are copied for each link data that is added to the Model.

The new value must not be null and must contain only Links, not Nodes or simple Parts. The Links must not be in the visual tree of any Diagram. Replacing this Map will automatically call RebuildParts().

If you modify this dictionary, by replacing a Link in it or by adding or removing a map entry, you need to explicitly call RebuildParts() afterwards.

MaxScale

Gets or sets the largest value that Scale may take.

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

This property is only used to limit the range of new values of Scale.

The default value is 100.0. Values must be no less than one. Setting this to a value that is less than the current Scale will cause the current diagram scale to be set to this new value.

MaxSelectionCount

Gets or sets the maximum number of selected objects.

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

The default value is a large positive integer. Values must be non-negative. Decreasing this value may cause objects to be removed from Selection in order to meet the new lower limit.

MinScale

Gets or sets the smallest value greater than zero that Scale may take.

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

This property is only used to limit the range of new values of Scale.

The default value is 0.0001. Values must be larger than zero and not greater than one. Setting this to a value that is greater than the current Scale will cause the current diagram scale to be set to this new value.

Model

Gets or sets the Model<TNodeData, TNodeKey, TSharedData> holding data corresponding to the data-bound nodes and links of this Diagram.

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

Replacing this value causes all of the bound Nodes and Links to be deleted and re-created from the new model data.

Models may be shared by multiple Diagrams. One common approach is to have two Diagrams displaying the same Model but using different templates (see NodeTemplate, NodeTemplateMap, and the associated link and group properties) and sometimes even different Layouts.

Setting this property does not notify about any changed event; the new value must not be null. Typically a new Model will have its own UndoManager, thereby replacing the Diagram's current UndoManager.

Replacing or re-setting the model will re-initialize the Diagram, taking in to account InitialPosition, InitialScale, InitialAutoScale, and InitialContentAlignment. It will also set IsModified to false.

The default behavior when replacing the model is to copy a few UndoManager properties to the new UndoManager, including IsEnabled and MaxHistoryLength.

It is an error to replace the Diagram.Model while a transaction is in progress.

MouseDragOver

Gets or sets the function to execute when the user is dragging the selection in the background of the Diagram during a DraggingTool drag-and-drop, not over any GraphObjects.

Declaration
public Action<InputEvent> MouseDragOver { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null.

Note that for a drag-and-drop that originates in a different diagram, the target diagram's selection collection will not be the parts that are being dragged. Instead the temporary parts being dragged can be found as the source diagram's CopiedParts.

This function is called with SkipsUndoManager temporarily set to true, so that any changes to GraphObjects are not recorded in the UndoManager. You do not need to start and commit any transaction in this function. After calling this function the diagram will be updated immediately.

For example, if you want to prevent the user from dropping Parts into the background of the diagram, and want to provide feedback about that during a drag:

myDiagram.MouseDragOver = (e) => {
  myDiagram.CurrentCursor = "no-drop";
}
See Also

MouseDrop

Gets or sets the function to execute when the user drops the selection in the background of the Diagram at the end of a DraggingTool drag-and-drop, not onto any GraphObjects.

Declaration
public Action<InputEvent> MouseDrop { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null.

For example, if you want to prevent the user from dropping Parts into the background of the diagram:

myDiagram.MouseDrop = (e) => {
  myDiagram.CurrentTool.DoCancel();
}
See Also

MouseEnter

Gets or sets the function to execute when the mouse (pointer) enters the Diagram.

Declaration
public Action<InputEvent> MouseEnter { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

MouseHold

Gets or sets the function to execute when the user holds the mouse (pointer) stationary in the background of the Diagram while holding down a button, not over any GraphObjects.

Declaration
public Action<InputEvent> MouseHold { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This property is used by the ToolManager.

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

MouseHover

Gets or sets the function to execute when the user holds the mouse (pointer) stationary in the background of the Diagram without holding down any buttons, not over any GraphObjects.

Declaration
public Action<InputEvent> MouseHover { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This property is used by the ToolManager.

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

MouseLeave

Gets or sets the function to execute when the mouse (pointer) leaves the Diagram.

Declaration
public Action<InputEvent> MouseLeave { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

If this property value is a function, it is called with an InputEvent. By default this property is null.

If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call StartTransaction(string) and CommitTransaction(string), or call Commit(Action<Diagram>, string).

See Also

MouseOver

Gets or sets the function to execute when the user moves the mouse (pointer) in the background of the Diagram without holding down any buttons, not over any GraphObjects.

Declaration
public Action<InputEvent> MouseOver { get; set; }
Property Value
Type Description
Action<InputEvent>
Remarks

This property is used by the ToolManager.

If this property value is a function, it is called with an InputEvent. By default this property is null.

This function is called with SkipsUndoManager temporarily set to true, so that any changes to GraphObjects are not recorded in the UndoManager. You do not need to start and commit any transaction in this function. After calling this function the diagram will be updated immediately.

See Also

Nodes

This read-only property returns a read-only collection of all Nodes and Groups in the Diagram.

Declaration
public IReadOnlyCollection<Node> Nodes { get; }
Property Value
Type Description
IReadOnlyCollection<Node>
Remarks

This includes both data-bound and unbound nodes, and both top-level nodes and nodes inside Groups. All of the simple Parts are accessible via the Parts property.

See Also

NodeSelectionAdornmentTemplate

Gets or sets the default selection Adornment template, used to adorn selected Parts other than Groups or Links.

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

Each Node or simple Part can have its own SelectionAdornmentTemplate, which if non-null will take precedence over this Diagram property.

This Adornment must not be in the visual tree of any Diagram.

NodeTemplate

Gets or sets the default Node template used as the archetype for node data that is added to the Model.

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

Setting this property just modifies the NodeTemplateMap by replacing the entry named with the empty string.

The value must not be null. The template may be either a Node or a simple Part, but not a Link or a Group.

This Part must not be in the visual tree of any Diagram.

NodeTemplateMap

Gets or sets a dictionary mapping template names to Parts.

Declaration
public IDictionary<string, Part> NodeTemplateMap { get; set; }
Property Value
Type Description
IDictionary<string, Part>
Remarks

These nodes are copied for each node data that is added to the Model.

The new value must not be null and must contain Nodes or simple Parts. These Parts must not be in the visual tree of any Diagram. Replacing this Map will automatically call RebuildParts().

If you modify this dictionary, by replacing a Node or by adding or removing a map entry, you need to explicitly call RebuildParts() afterwards. Any new map values must not be Links or Groups.

If you want to create Groups, use GroupTemplateMap instead.

Opacity

Gets or sets the opacity for all parts in this diagram.

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

The value must be between 0.0 (fully transparent) and 1.0 (no additional transparency). This value is multiplicative with any existing transparency, for instance from a Brush or image transparency. The default value is 1.

See Also

Padding

Gets or sets the Margin that describes the Diagram's padding, which controls how much extra space in document coordinates there is around the area occupied by the document.

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

This keeps nodes from butting up against the side of the diagram (unless scrolled).

The default value is a margin of 5, all around the edge of the document.

Parts

This read-only property returns a read-only collection of all Parts in the Diagram that are not Nodes or Links or Adornments.

Declaration
public IReadOnlyCollection<Part> Parts { get; }
Property Value
Type Description
IReadOnlyCollection<Part>
Remarks

This includes both data-bound and unbound parts, and both top-level parts and parts inside Groups. Use the Nodes or Links properties for getting the collection of all Nodes or Links in the diagram.

Position

Gets or sets the coordinates of this Diagram in the viewport.

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

Value must be of type Point in document coordinates. The default is Point(double.NaN, double.NaN), but is typically set to a real value when a Diagram is initialized.

Scrolling and panning the Diagram modify the Diagram's position.

Setting this property does not notify about any changed event. However you can listen for a DiagramEvent by adding to a Diagram EventHandler property. with the name "ViewportBoundsChanged".

The ViewportBounds x and y values are always the same as the Diagram's position values.

If you set this property any replacement of the Model will result in a layout and a computation of new DocumentBounds, which in turn may cause the diagram to be scrolled and zoomed, depending on various Diagram properties named "Initial...". You may want to set InitialPosition instead of setting this property around the time that you are loading a model.

PositionComputation

Gets or sets the function used to determine the position that this Diagram can be scrolled or moved to.

Declaration
public Func<Diagram, Point, Point> PositionComputation { get; set; }
Property Value
Type Description
Func<Diagram, Point, Point>
Remarks

By default this function is null and the Diagram's position is bound only by the document bounds.

When this property is set the function is given a reference to the diagram and the proposed new position Point. The function must return a new point.

An example that disallows decimal position values:

Point ComputeIntegralPosition(diagram, pt) {
  return new Point(Math.Floor(pt.X), Math.Floor(pt.Y));
}

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

Scale

Gets or sets the scale transform of this Diagram.

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

Value must be a positive number. The default value is 1. Any new value will be coerced to be between MinScale and MaxScale.

Scale can automatically be set by the AutoScale property. There are also InitialScale and InitialAutoScale for setting the scale on (re)initialization of a Diagram.

Setting this property does not notify about any changed event. However you can listen for a DiagramEvent by adding to a Diagram EventHandler property. with the name "ViewportBoundsChanged".

If you set this property any replacement of the Model will result in a layout and a computation of new DocumentBounds, which in turn may cause the diagram to be scrolled and zoomed, depending on various Diagram properties named "Initial...". You may want to set InitialScale instead of setting this property around the time that you are loading a model.

ScaleComputation

Gets or sets the function used to determine valid scale values for this Diagram.

Declaration
public Func<Diagram, double, double> ScaleComputation { get; set; }
Property Value
Type Description
Func<Diagram, double, double>

ScrollHorizontalLineChange

Gets or sets the distance in screen pixels that the horizontal scrollbar will scroll when scrolling by a line.

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

The default value is 16.

See Also

ScrollMargin

Gets or sets a scrollable area in document coordinates that surrounds the document bounds, allowing the user to scroll into empty space.

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

The margin is only effective in each direction when the document bounds plus margin is greater than the viewport bounds.

The default value is a margin of 0, all around the edge of the document.

ScrollMode

Gets or sets the scrollMode of the Diagram, allowing the user to either scroll to document bound borders with Document, or scroll endlessly with Infinite.

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

The default value is Document. Changing this property value does not raise a Changed event.

ScrollsPageOnFocus

Gets or sets whether the page may be scrolled when the diagram receives focus.

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

This happens in some environments when the top-left corner of the diagram's element is scrolled out of view, the diagram does not have focus, and the user clicks in the diagram.

The default value is false.

ScrollVerticalLineChange

Gets or sets the distance in screen pixels that the vertical scrollbar will scroll when scrolling by a line.

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

The default value is 16.

See Also

Selection

This read-only property returns the read-only collection of selected objects. Most commands and many tools operate on this collection.

Declaration
public IReadOnlyCollection<Part> Selection { get; }
Property Value
Type Description
IReadOnlyCollection<Part>
Remarks

Do not modify this collection. If you want to select or deselect a particular object in a Diagram, set the IsSelected property. If you want to select a collection of Parts, call Select(IEnumerable<Part>). If you want to deselect all objects, call ClearSelection(bool). If you want to deselect all objects and select a single object, call Select(Part).

You can limit how many objects the user can select by setting MaxSelectionCount.

There are also DiagramEvents for ChangingSelection and ChangedSelection, which are raised by commands and tools before and after changes to this selection collection.

Note that Selection collection and IsSelected property are completely independent of the Highlighteds collection and the IsHighlighted property.

SkipsUndoManager

Gets or sets whether ChangedEvents are not recorded by the UndoManager.

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

The initial and normal value is false. WARNING: while this property is true do not perform any changes that cause any previous transactions to become impossible to undo.

While this property is true, changing the Diagram or any GraphObject does not call HandleChanged(ChangedEvent). Even when this property is true, transactions (such as calls to StartTransaction(string)) and undo/redo (such as calls to Undo()) are still delegated to the UndoManager.

You should set this to true only temporarily, and you should remember its previous value before setting this to true. When finishing the period for which you want the UndoManager to be disabled, you should set this back to the remembered value it had before it was set to true.

For more permanent disabling of the UndoManager, set IsEnabled to false.

Setting this property also sets SkipsUndoManager to the same value. Setting this property does not notify about any changed event.

ToolManager

Gets or sets the ToolManager for this Diagram.

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

This tool is used for mode-less operation. It is responsible for choosing a particular tool to run as the CurrentTool.

This tool is normally also the DefaultTool. If you don't want the ToolManager to run at all, replace the DefaultTool with your own tool.

Setting this property does not notify about any changed event. The value cannot be null and must not be shared with other Diagrams. If you set this property, you will probably also want to set DefaultTool.

See Also

ToolTip

This tooltip is shown when the mouse (pointer) stays motionless in the background. This value is typically an Adornment, which implements IShowHidable.

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

The default value is null, which means no tooltip is shown.

Here is a simple example:

myDiagram.ToolTip =
  new Adornment(PanelLayoutAuto.Instance)
    .Add(
      new Shape { Fill = "#CCFFCC" },
      new TextBlock("This diagram lets you control the world.") { Margin = 4 }
    );
See Also

UndoManager

This read-only property returns the UndoManager for this Diagram, which actually belongs to the Model<TNodeData, TNodeKey, TSharedData>.

Declaration
public UndoManager UndoManager { get; }
Property Value
Type Description
UndoManager
Remarks

The default UndoManager has its IsEnabled property set to false. If you want users to undo and redo, you should set that property to true once you have initialized the Diagram or its Model.

Note that the UndoManager might be shared with other Diagrams that are showing the same Model. The UndoManager might also be shared with other Models too.

ValidCycle

Gets or sets what kinds of graphs this diagram allows the user to draw.

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

By default this property is All -- all kinds of cycles are permitted. Common values include DestinationTree and NotDirected.

VersionName

Gets the name of the version of GoDiagram being used.

Declaration
public static string VersionName { get; }
Property Value
Type Description
string

ViewportBounds

This read-only property returns the bounds of the portion of the Diagram in document coordinates that is viewable.

Declaration
public Rect ViewportBounds { get; }
Property Value
Type Description
Rect
Remarks

Typically when the viewport bounds are smaller than the DocumentBounds, the user can scroll or pan the view.

The x and y coordinates are equal to the Position of the Diagram, and the width and height are equal to the Diagram's canvas width and height, divided by the Scale.

ViewSize

Gets or sets a fixed size in document coordinates to be returned by ViewportBounds. This is typically only set when the Diagram isn't associated with a visual component.

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

This is typically only set when the Diagram isn't associated with a visual component. This property is intended to be used in environments where there is no Diagram component expected, to simulate the size of the component. Normally, the ViewportBounds is sized by the component instead.

By default this is Size(double.NaN, double.NaN). If this property is set, its size will always be used to compute the ViewportBounds, even if a component is being used. It is uncommon to set both this property and use a component.

See Also

ZoomPoint

Gets or sets the zoom point of this Diagram, in viewport coordinates.

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

This is used by StandardMouseWheel() and scale-setting commands to control where to zoom in or out.

Typical usage is to remember the value of this property and to set this property to some point within the viewport (between zero and the canvas width and height). This is commonly accomplished by using the ViewPoint of LastInput. Then one changes the Scale somehow, perhaps by executing one of the CommandHandler commands, or by rotating the mouse wheel, or just by setting the Scale property. Finally one restores the original value of this property.

The default value is Point(double.NaN, double.NaN). Value must be of type Point, in element coordinates, not in document coordinates. Setting this property does not notify about any changed event.

Methods

Add(Part)

Adds a Part to the Layer that matches the Part's LayerName, or else the default layer, which is named with the empty string.

Declaration
public void Add(Part part)
Parameters
Type Name Description
Part part
Remarks

Normally parts added to a diagram are top-level parts. If you want nodes to be members of a Group, in addition to calling this method call AddMembers(IEnumerable<Part>, bool) or set each ContainingGroup.

See Also

AddLayer(Layer)

Adds a new Layer to the list of layers.

Declaration
public Diagram AddLayer(Layer layer)
Parameters
Type Name Description
Layer layer

The new Layer to add. It is an error if the Layer already belongs to a Diagram.

Returns
Type Description
Diagram

this Diagram

Remarks

If IsTemporary is false, the layer is added after all existing non-temporary layers. If IsTemporary is true, the layer is added as the very last layer.

See Also

AddLayerAfter(Layer, Layer)

Adds a layer to the list of layers after a specified layer.

Declaration
public Diagram AddLayerAfter(Layer layer, Layer existingLayer)
Parameters
Type Name Description
Layer layer

the new Layer to add or existing Layer to move in Z-order.

Layer existingLayer

the other Layer in this Diagram which should come just before the new or moved layer.

Returns
Type Description
Diagram

this Diagram

Remarks

This method can also re-order layers.

See Also

AddLayerBefore(Layer, Layer)

Adds a layer to the list of layers before a specified layer.

Declaration
public Diagram AddLayerBefore(Layer layer, Layer existingLayer)
Parameters
Type Name Description
Layer layer

the new Layer to add or existing Layer to move in Z-order.

Layer existingLayer

the other Layer in this Diagram which should come just after the new or moved layer.

Returns
Type Description
Diagram

this Diagram

Remarks

This method can also re-order layers.

See Also

AlignDocument(Spot, Spot)

Aligns the Diagram's Position based on a desired document Spot and viewport Spot.

Declaration
public void AlignDocument(Spot documentspot, Spot viewportspot)
Parameters
Type Name Description
Spot documentspot
Spot viewportspot

CenterRect(Rect)

Modifies the Position to show a given Rect of the Diagram by centering the viewport on that Rect.

Declaration
public void CenterRect(Rect r)
Parameters
Type Name Description
Rect r
Remarks

If the rect is near the DocumentBounds and if the ScrollMargin is small, it might not be possible to scroll far enough to actually put the Rect area in the center of the viewport.

See Also

Clear()

Removes all Parts from the Diagram, including unbound Parts except for the background grid, and also clears out the Model and UndoManager and clipboard. This operation is not undoable.

Declaration
public void Clear()
Remarks

Alternative actions are to replace the Model with a new Model<TNodeData, TNodeKey, TSharedData> (probably a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> or a TreeModel<TNodeData, TNodeKey, TSharedData>), or to set NodeDataSource with an empty JavaScript Array (and LinkDataSource).

This does not remove any listeners from the diagram.

ClearHighlighteds()

Remove highlights from all Parts.

Declaration
public void ClearHighlighteds()
Remarks

This removes all parts from the Highlighteds collection.

Note that no predefined command or tool operates on the Highlighteds collection, and there is no predefined visual rendering when a part becomes IsHighlighted.

See Also

ClearSelection(bool)

Deselect all selected Parts.

Declaration
public void ClearSelection(bool skipsEvents = false)
Parameters
Type Name Description
bool skipsEvents

if true, do not raise the DiagramEvents "ChangingSelection" and "ChangedSelection"; if not supplied the value is assumed to be false.

Remarks

This removes all parts from the Selection collection. This method raises the "ChangingSelection" and "ChangedSelection" Diagram events.

See Also

Commit(Action<Diagram>, string)

Starts a new transaction, calls the provided function, and commits the transaction.

Declaration
public void Commit(Action<Diagram> func, string tname = "")
Parameters
Type Name Description
Action<Diagram> func

the function to call as the transaction body

string tname

a descriptive name for the transaction, or null to temporarily set SkipsUndoManager to true; if no string transaction name is given, an empty string is used as the transaction name

Remarks

Code is called within a try-finally statement. If the function does not return normally, this rolls back the transaction rather than committing it. Example usage:

myDiagram.Commit(d => d.Remove(somePart), "Remove Part");

Note: passing null as the second argument will temporarily set SkipsUndoManager to true. It is commonplace to call this method with no second argument, which would commit a transaction with a transaction name that is the empty string.

CommitTransaction(string)

Commit the changes of the current transaction.

Declaration
public bool CommitTransaction(string tname = "")
Parameters
Type Name Description
string tname

a descriptive name for the transaction.

Returns
Type Description
bool

the value returned by CommitTransaction(string).

Remarks

This just calls CommitTransaction(string).

ComputeBounds()

This is called during a Diagram update to determine a new value for DocumentBounds.

Declaration
public virtual Rect ComputeBounds()
Returns
Type Description
Rect

a Rect in document coordinates.

Remarks

By default this computes the union of the bounds of all the visible GraphObjects in this Diagram, unless FixedBounds is set.

This ignores parts for which IsVisible() is false and ignores those for which IsInDocumentBounds is false. The returned value includes the addition of the Padding margin.

To compute the bounds of a collection of Parts, call ComputePartsBounds(IEnumerable<Part>, bool).

ComputeMove(Part, Point, DraggingOptions)

Computes the new location for a Node or simple Part, given a new desired location.

Declaration
public Point ComputeMove(Part n, Point newloc, DraggingOptions dragOptions)
Parameters
Type Name Description
Part n

the Node or simple Part that is being moved

Point newloc

the proposed new location

DraggingOptions dragOptions

the dragging options

Returns
Type Description
Point

the possibly grid-snapped computed Point that is within the minimum and maximum permitted locations

Remarks

Takes any grid-snapping, any DragComputation function, and any MinLocation and MaxLocation into consideration.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

ComputePartsBounds(IEnumerable<Part>, bool)

Find the union of the ActualBounds of all of the Parts in the given collection, excluding Links unless the second argument is true.

Declaration
public Rect ComputePartsBounds(IEnumerable<Part> coll, bool includeLinks = false)
Parameters
Type Name Description
IEnumerable<Part> coll

an iterable collection or Array of Parts.

bool includeLinks

defaults to false

Returns
Type Description
Rect

This returns the bounding area of the given Parts; if there are no Parts in the collection, this returns a Rect with zero width and height and an X and Y that are NaN.

Remarks

Unlike ComputeBounds(), this ignores the visibility of each Part and does not add any padding to the result.

CopyParts(IEnumerable<Part>, Diagram, bool)

Make a copy of a collection of Parts and return them in a dictionary mapping each original Part to its copy. It may optionally add them to a given Diagram.

Declaration
public IDictionary<Part, Part> CopyParts(IEnumerable<Part> coll, Diagram diagram, bool check = false)
Parameters
Type Name Description
IEnumerable<Part> coll

A collection of Parts.

Diagram diagram

The destination diagram; if null, the copied parts are not added to this diagram.

bool check

Whether to check CanCopy() on each part; default value is false.

Returns
Type Description
IDictionary<Part, Part>
Remarks

Copying a Group will also copy its member Nodes and Links. Copying a Link will also copy any label Nodes that it owns.

This does not perform a transaction nor does it raise a DiagramEvent. Call CopySelection(), which calls this method, if you want to copy all selected Parts into the clipboard. The CopySelection() command may also copy additional Parts as well, depending on CopiesTree.

DelayInitialization(Action<Diagram>)

Updates the diagram immediately, then resets initialization flags so that actions taken in the argument function will be considered part of Diagram initialization, and will participate in initial layouts, InitialAutoScale, InitialContentAlignment, etc.

Declaration
public void DelayInitialization(Action<Diagram> func)
Parameters
Type Name Description
Action<Diagram> func

an optional procedure taking a Diagram argument to perform as part of another diagram initialization.

Remarks

This is useful in situations where you do not wish for the first content added to the diagram to be considered the "initial" content, such as with a Node that represents a "Loading" bar.

EnsureBounds()

Ensures that the DocumentBounds are up to date.

Declaration
public void EnsureBounds()
Remarks

This is sometimes necessary when operations need updated document bounds immediately.

It is uncommon to call this method outside of customization. For efficiency, do not call this method unnecessarily.

See Also

FindElementAt(Point, Func<GraphObject, GraphObject>, Predicate<GraphObject>)

A convenience function for FindElementAt<T>(Point, Func<GraphObject, T>, Predicate<T>), returning a GraphObject rather than a specified type.

Declaration
public GraphObject FindElementAt(Point p, Func<GraphObject, GraphObject> navig = null, Predicate<GraphObject> pred = null)
Parameters
Type Name Description
Point p
Func<GraphObject, GraphObject> navig
Predicate<GraphObject> pred
Returns
Type Description
GraphObject

FindElementAt<T>(Point, Func<GraphObject, T>, Predicate<T>)

Find the front-most GraphObject at the given point in document coordinates.

Declaration
public T FindElementAt<T>(Point p, Func<GraphObject, T> navig = null, Predicate<T> pred = null) where T : GraphObject
Parameters
Type Name Description
Point p

A Point in document coordinates.

Func<GraphObject, T> navig

A function taking a GraphObject and returning a GraphObject, defaulting to the identity.

Predicate<T> pred

A function taking the GraphObject returned by navig and returning true if that element should be returned, defaulting to a predicate that always returns true.

Returns
Type Description
T

The first GraphObject returned by the navig function and satisfying the pred function that is at the point p, in Z-order from front to back, or else null if nothing is found.

Type Parameters
Name Description
T
Remarks

If Visible is false, this method will not find any objects in that layer. However, Opacity does not affect this method.

Example usage:

// Returns the top-most selectable Part, or null if there isn't one
myDiagram.FindElementAt<Part>(
  myDiagram.LastInput.DocumentPoint,
  // Navigation function
  (x) => { return x.Part; },
  // Because of the navigation function, p will always be a Part.
  (p) => { return p.CanSelect(); }
);
See Also

FindElementsAt(Point, Func<GraphObject, GraphObject>, Predicate<GraphObject>, ICollection<GraphObject>)

A convenience function for FindElementsAt<T, S>(Point, Func<GraphObject, T>, Predicate<T>, S), returning a collection of GraphObjects rather than a collection of the specified type.

Declaration
public ICollection<GraphObject> FindElementsAt(Point p, Func<GraphObject, GraphObject> navig = null, Predicate<GraphObject> pred = null, ICollection<GraphObject> coll = null)
Parameters
Type Name Description
Point p
Func<GraphObject, GraphObject> navig
Predicate<GraphObject> pred
ICollection<GraphObject> coll
Returns
Type Description
ICollection<GraphObject>

FindElementsAt<T, S>(Point, Func<GraphObject, T>, Predicate<T>, S)

Find a collection of GraphObjects at the given point in document coordinates.

Declaration
public S FindElementsAt<T, S>(Point p, Func<GraphObject, T> navig = null, Predicate<T> pred = null, S coll = null) where T : GraphObject where S : class, ICollection<T>
Parameters
Type Name Description
Point p

A Point in document coordinates.

Func<GraphObject, T> navig

A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

Predicate<T> pred

A function taking the GraphObject returned by navig and returning true if that element should be returned, defaulting to a predicate that always returns true.

S coll

An optional collection to add the results to.

Returns
Type Description
S

a collection of GraphObjects returned by the navig function and satisfying the pred that are located at the point p, or else an empty collection. If a collection was passed in, it is returned.

Type Parameters
Name Description
T
S
Remarks

If Visible is false, this method will not find any objects in that layer. However, Opacity does not affect this method.

Example usage:

// Returns the Nodes that are at a given point, overlapping each other
myDiagram.FindElementsAt<Node>(somePoint,
  // Navigation function -- only return Nodes
  (x) => { var p = x.Part; return (p is Node) ? p : null; }
);
See Also

FindElementsIn(Rect, Func<GraphObject, GraphObject>, Predicate<GraphObject>, bool, ICollection<GraphObject>)

A convenience function for FindElementsIn<T, S>(Rect, Func<GraphObject, T>, Predicate<T>, bool, S), returning a collection of GraphObjects rather than a collection of the specified type.

Declaration
public ICollection<GraphObject> FindElementsIn(Rect r, Func<GraphObject, GraphObject> navig = null, Predicate<GraphObject> pred = null, bool partialInclusion = false, ICollection<GraphObject> coll = null)
Parameters
Type Name Description
Rect r
Func<GraphObject, GraphObject> navig
Predicate<GraphObject> pred
bool partialInclusion
ICollection<GraphObject> coll
Returns
Type Description
ICollection<GraphObject>

FindElementsIn<T, S>(Rect, Func<GraphObject, T>, Predicate<T>, bool, S)

Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates.

Declaration
public S FindElementsIn<T, S>(Rect r, Func<GraphObject, T> navig = null, Predicate<T> pred = null, bool partialInclusion = false, S coll = null) where T : GraphObject where S : class, ICollection<T>
Parameters
Type Name Description
Rect r

A Rect in document coordinates.

Func<GraphObject, T> navig

A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

Predicate<T> pred

A function taking the GraphObject returned by navig and returning true if that element should be returned, defaulting to a predicate that always returns true.

bool partialInclusion

Whether an element can match if it merely intersects the rectangular area (true) or if it must be entirely inside the rectangular area (false). The default value is false.

S coll

An optional collection to add the results to.

Returns
Type Description
S

a collection of GraphObjects returned by the navig function and satisfying the pred function that are within the rectangle r, or else an empty collection. If a collection was passed in, it is returned.

Type Parameters
Name Description
T
S
Remarks

If Visible is false, this method will not find any objects in that layer. However, Opacity does not affect this method.

Example usage:

// Returns the Links that intersect a given rectangle and have a certain data property
myDiagram.FindElementsIn<Link>(someRect,
  // Navigation function -- only return Links
  (x) => { var p = x.Part; return (p is Link) ? p : null; },
  // Predicate that always receives a Link, due to above navigation function
  (link) => { return link.Data.SomeProp > 17; },
  // the links may only partly overlap the given rectangle
  true
);
See Also

FindElementsNear(Point, double, Func<GraphObject, GraphObject>, Predicate<GraphObject>, bool, ICollection<GraphObject>)

A convenience function for FindElementsNear<T, S>(Point, double, Func<GraphObject, T>, Predicate<T>, bool, S), returning a collection of GraphObjects rather than a collection of the specified type.

Declaration
public ICollection<GraphObject> FindElementsNear(Point p, double dist, Func<GraphObject, GraphObject> navig = null, Predicate<GraphObject> pred = null, bool partialInclusion = true, ICollection<GraphObject> coll = null)
Parameters
Type Name Description
Point p
double dist
Func<GraphObject, GraphObject> navig
Predicate<GraphObject> pred
bool partialInclusion
ICollection<GraphObject> coll
Returns
Type Description
ICollection<GraphObject>

FindElementsNear<T, S>(Point, double, Func<GraphObject, T>, Predicate<T>, bool, S)

Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.

Declaration
public S FindElementsNear<T, S>(Point p, double dist, Func<GraphObject, T> navig = null, Predicate<T> pred = null, bool partialInclusion = true, S coll = null) where T : GraphObject where S : class, ICollection<T>
Parameters
Type Name Description
Point p

A Point in document coordinates.

double dist

The distance from the point.

Func<GraphObject, T> navig

A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

Predicate<T> pred

A function taking the GraphObject returned by navig and returning true if that element should be returned, defaulting to a predicate that always returns true.

bool partialInclusion

Whether an element can match if it merely intersects the circular area (true) or if it must be entirely inside the circular area (false). The default value is true. The default is true.

S coll

An optional collection to add the results to.

Returns
Type Description
S

a collection of GraphObjects returned by the navig function and satisfying the pred that are located near the point p, or else an empty collection. If a collection was passed in, it is returned.

Type Parameters
Name Description
T
S
Remarks

If Visible is false, this method will not find any elements in that layer. However, Opacity does not affect this method.

Example usage:

// Returns the Nodes that intersect a given circular area and have a certain data property
myDiagram.FindElementsNear<Node>(somePoint,
  // The circular area is centered at somePoint and has radius 100
  100,
  // Navigation function -- only return Nodes
  (x) => { var p = x.Part; return (p is Node) ? p : null; },
  // Predicate that always receives a Node, due to above navigation function
  (node) => { return node.Data.SomeProp > 17; },
  // the nodes may only partly overlap the given circular area
  true
);
See Also

FindLayer(string)

Finds a layer with a given name.

Declaration
public Layer FindLayer(string name)
Parameters
Type Name Description
string name
Returns
Type Description
Layer

a Layer with the given name, or null if no such layer was found.

See Also

FindLinkForData(object)

Declaration
public Link FindLinkForData(object linkdata)
Parameters
Type Name Description
object linkdata

an object matched by reference identity

Returns
Type Description
Link

an existing Link in this Diagram that was created because its Part.Data was the link data in the Diagram's Model<TNodeData, TNodeKey, TSharedData>.

FindLinkForKey(object)

Look for a Link corresponding to a model's link data object's unique key.

Declaration
public Link FindLinkForKey(object key)
Parameters
Type Name Description
object key

a key.

Returns
Type Description
Link

null if a link data with that key cannot be found in the model, or if a corresponding Link cannot be found in the Diagram, or if the model is a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> without LinkKeyProperty set to a non-empty string.

FindNodeForData(object)

Look for a Node or Group corresponding to a model's node data object.

Declaration
public Node FindNodeForData(object nodedata)
Parameters
Type Name Description
object nodedata

an object matched by reference identity

Returns
Type Description
Node

an existing Node or Group in this Diagram that was created because its Part.Data was the node data in the Diagram's Model<TNodeData, TNodeKey, TSharedData>. This will be null if there is no such part or if it's just a Part or Link.

FindNodeForKey(object)

Look for a Node or Group corresponding to a model's node data object's unique key.

Declaration
public Node FindNodeForKey(object key)
Parameters
Type Name Description
object key

a key.

Returns
Type Description
Node

null if a node data with that key cannot be found in the model, or if a corresponding Node or Group cannot be found in the Diagram, or if what is found is just a Part.

FindPartAt(Point, bool)

This convenience function finds the front-most Part that is at a given point that might be selectable and that is not in a temporary layer.

Declaration
public Part FindPartAt(Point p, bool selectable = true)
Parameters
Type Name Description
Point p

a Point in document coordinates.

bool selectable

Whether to only consider parts that are Selectable. The default is true.

Returns
Type Description
Part
Remarks

This just calls FindElementAt(Point, Func<GraphObject, GraphObject>, Predicate<GraphObject>) with appropriate arguments, but ignoring Layers that are IsTemporary.

See Also

FindPartForData(object)

Look for a Part, Node, Group, or Link corresponding to a Model<TNodeData, TNodeKey, TSharedData>'s data object.

Declaration
public Part FindPartForData(object data)
Parameters
Type Name Description
object data

an object matched by reference identity

Returns
Type Description
Part

an existing Part in this Diagram that was created because its Part.Data was the data in the Diagram's Model<TNodeData, TNodeKey, TSharedData>.

Remarks

We recommend that you call FindNodeForData(object) or FindLinkForData(object) if you are looking for a Node or a Link.

FindPartForKey(object)

Look for a Part or Node or Group corresponding to a model's data object's unique key.

Declaration
public Part FindPartForKey(object key)
Parameters
Type Name Description
object key

a key.

Returns
Type Description
Part

null if a data with that key cannot be found in the model, or if a corresponding Part cannot be found in the Diagram. This will not return a Link unless the model is a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> and LinkKeyProperty has been set. If the same key is used for both a node data object and a link data object, this will return a Node.

Remarks

This will find a Link if the model is a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> that is maintaining a key on the link data objects.

FindPartsAt(Point, bool, ICollection<Part>)

A convenience function for FindPartsAt<T, S>(Point, bool, S), returning a collection of Parts rather than a collection of the specified type.

Declaration
public ICollection<Part> FindPartsAt(Point p, bool selectable = true, ICollection<Part> coll = null)
Parameters
Type Name Description
Point p
bool selectable
ICollection<Part> coll
Returns
Type Description
ICollection<Part>

FindPartsAt<T, S>(Point, bool, S)

This convenience function finds all Parts that are at a point in document coordinates and that are not in temporary layers.

Declaration
public S FindPartsAt<T, S>(Point p, bool selectable = true, S coll = null) where T : Part where S : class, ICollection<T>
Parameters
Type Name Description
Point p

A Point in document coordinates.

bool selectable

Whether to only consider parts that are Selectable. The default is true.

S coll

An optional collection to add the results to.

Returns
Type Description
S
Type Parameters
Name Description
T
S
See Also

FindPartsIn(Rect, bool, bool, ICollection<Part>)

A convenience function for FindPartsIn<T, S>(Rect, bool, bool, S), returning a collection of Parts rather than a collection of the specified type.

Declaration
public ICollection<Part> FindPartsIn(Rect r, bool partialInclusion = false, bool selectable = true, ICollection<Part> coll = null)
Parameters
Type Name Description
Rect r
bool partialInclusion
bool selectable
ICollection<Part> coll
Returns
Type Description
ICollection<Part>

FindPartsIn<T, S>(Rect, bool, bool, S)

This convenience function finds Parts that are inside or that intersect a given Rect in document coordinates.

Declaration
public S FindPartsIn<T, S>(Rect r, bool partialInclusion = false, bool selectable = true, S coll = null) where T : Part where S : class, ICollection<T>
Parameters
Type Name Description
Rect r

a Rect in document coordinates.

bool partialInclusion

Whether a Part can match if it merely intersects the rectangular area (true) or if it must be entirely inside the rectangular area (false). The default value is false.

bool selectable

Whether to only consider parts that are Selectable. The default is true.

S coll

An optional collection to add the results to.

Returns
Type Description
S
Type Parameters
Name Description
T
S
Remarks

This just calls FindElementsIn<T, S>(Rect, Func<GraphObject, T>, Predicate<T>, bool, S) with appropriate arguments, but ignoring Layers that are IsTemporary.

See Also

FindPartsNear(Point, double, bool, bool, ICollection<Part>)

A convenience function for FindPartsNear<T, S>(Point, double, bool, bool, S), returning a collection of Parts rather than a collection of the specified type.

Declaration
public ICollection<Part> FindPartsNear(Point p, double dist, bool partialInclusion = true, bool selectable = true, ICollection<Part> coll = null)
Parameters
Type Name Description
Point p
double dist
bool partialInclusion
bool selectable
ICollection<Part> coll
Returns
Type Description
ICollection<Part>

FindPartsNear<T, S>(Point, double, bool, bool, S)

This convenience function finds Parts that are within a certain distance of a given point in document coordinates.

Declaration
public S FindPartsNear<T, S>(Point p, double dist, bool partialInclusion = true, bool selectable = true, S coll = null) where T : Part where S : class, ICollection<T>
Parameters
Type Name Description
Point p

A Point in document coordinates.

double dist

The distance from the point.

bool partialInclusion

Whether an element can match if it merely intersects the circular area (true) or if it must be entirely inside the circular area (false). The default is true.

bool selectable

Whether to only consider parts that are Selectable. The default is true.

S coll

An optional collection to add the results to.

Returns
Type Description
S
Type Parameters
Name Description
T
S
Remarks

This just calls FindElementsNear<T, S>(Point, double, Func<GraphObject, T>, Predicate<T>, bool, S) with appropriate arguments, but ignoring Layers that are IsTemporary.

See Also

FindTopLevelGroups()

Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.

Declaration
public IEnumerator<Group> FindTopLevelGroups()
Returns
Type Description
IEnumerator<Group>
Remarks

This is useful for when you want to traverse the diagram's graph by recursing into Groups.

FindTreeRoots()

Returns an iterator of all top-level Nodes that have no tree parents.

Declaration
public IEnumerator<Node> FindTreeRoots()
Returns
Type Description
IEnumerator<Node>
Remarks

This is useful for when you want to traverse the diagram's graph by starting at the root of each tree, assuming that the diagram consists of one tree or a forest of trees.

Focus()

Explicitly bring focus to the Diagram's canvas.

If ScrollsPageOnFocus is false, this tries to keep the page at the same scroll position that it had before calling Focus(). This method is not overridable.

Declaration
public void Focus()

Highlight(Part)

Make the given part the only highlighted part.

Declaration
public void Highlight(Part part)
Parameters
Type Name Description
Part part

a Part that is already in a layer of this Diagram. If the value is null, this does nothing.

Remarks

Afterwards the Highlighteds collection will have only the given part in it.

Note that no predefined command or tool operates on the Highlighteds collection, and there is no predefined visual rendering when a part becomes IsHighlighted.

See Also

Highlight(IEnumerable<Part>)

Highlight all of the Parts supplied in the given collection, and unhighlight all other highlighted Parts.

Declaration
public void Highlight(IEnumerable<Part> coll)
Parameters
Type Name Description
IEnumerable<Part> coll

A collection of Parts to be highlighted.

Remarks

Note that no predefined command or tool operates on the Highlighteds collection, and there is no predefined visual rendering when a part becomes IsHighlighted.

See Also

LayoutDiagram(bool)

Perform all invalid layouts.

Declaration
public void LayoutDiagram(bool invalidateAll = false)
Parameters
Type Name Description
bool invalidateAll

If true, this will explicitly set IsValidLayout to false on each Layout in the diagram.

Remarks

If the optional argument is true, this will perform all of the layouts (Layout and all Layouts), not just the invalid ones.

Under normal circumstances you should not need to call this method, because layouts will be performed automatically after they become invalid. However you may have disabled automatic layouts by setting IsInitial and/or IsOngoing to false, or by restricting a Part's LayoutConditions. If that is the case you might call this method (perhaps due to a user command) to perform the layout at a time of your choosing.

LicenseKeyForDLL(string)

This static/shared method associates a runtime license key with the assembly that calls this method.

Declaration
public static string LicenseKeyForDLL(string key)
Parameters
Type Name Description
string key
Returns
Type Description
string
Remarks

This should always be called before your assembly constructs a Diagram.

The recommended way to do that is to use a static initializer or static constructor in one of the classes defined in your DLL.

For example:

private static string _LK = Diagram.LicenseKeyForDLL("...");

MakeImage(ImageDataProperties)

Create a bitmap of the current Diagram and returns it as a Bitmap. This calls MakeImageData(ImageDataProperties).

Declaration
public Bitmap MakeImage(ImageDataProperties properties = null)
Parameters
Type Name Description
ImageDataProperties properties

an ImageDataProperties object detailing options arguments for image creation

Returns
Type Description
Bitmap

a Bitmap depicting the Diagram.

Remarks

See the page on Making Images for more usage examples.

At the current time, this method does not work on Overviews.
See Also

MakeImageData(ImageDataProperties)

Create an image of the current Diagram encoded as a base64 string.

Declaration
public string MakeImageData(ImageDataProperties properties = null)
Parameters
Type Name Description
ImageDataProperties properties

an ImageDataProperties object detailing options arguments for image creation

Returns
Type Description
string

a base64-encoded string describing an image

Remarks

See the page on Making Images for more usage examples.

At the current time, this method does not work on Overviews.
Examples
myDiagram.MakeImageData(new ImageDataProperties {
  Scale = 1.5,
  Size = new Size(100, 100)
});

MoveParts(IEnumerable<Part>, Point, bool, DraggingOptions)

Move a collection of Parts in this Diagram by a given offset.

Declaration
public void MoveParts(IEnumerable<Part> coll, Point offset, bool check = false, DraggingOptions dragOptions = null)
Parameters
Type Name Description
IEnumerable<Part> coll

A collection of Parts, or null to move all of the Parts in this Diagram.

Point offset

the amount to move each Part, in document coordinates.

bool check

Whether to check CanMove() on each part; default value is false.

DraggingOptions dragOptions

Optional dragging options. By default this uses the settings from the Diagram's DraggingTool.

Remarks

Moving a Group will also move its member Nodes and Links. Moving with a zero X and a zero Y offset is potentially useful in order to snap Parts to the grid if IsGridSnapEnabled is true.

This does not perform a transaction nor does it raise a DiagramEvent.

RebuildParts()

Remove all of the Parts created from model data and then create them again.

Declaration
public void RebuildParts()
Remarks

This must be called after modifying or replacing any of the template maps such as NodeTemplateMap. This re-selects all of the new Parts that were created from data of the original selected Parts.

If you modify a template Map, there is no notification that the map has changed. You will need to call rebuildParts explicitly. If you are replacing the NodeTemplate or the NodeTemplateMap or the corresponding properties for Groups or Links, the Diagram property setters will automatically call RebuildParts.

It is extremely wasteful to call this method after making some model data changes that you want to be reflected in the diagram. Instead, it is better call Set(object, string, object), AddNodeData(TNodeData), RemoveNodeData(TNodeData), or other model methods. Not only do those methods update efficiently, they also preserve unbound state and support undo/redo.

Remove(Part)

Removes a Part from its Layer, provided the Layer is in this Diagram.

Declaration
public void Remove(Part part)
Parameters
Type Name Description
Part part
Remarks

Removing a Node will also remove any Links that are connected with it. Removing a Group will also remove all of its members. Removing a Link will also remove all of its label Nodes, if it has any.

See Also

RemoveLayer(Layer)

Removes the given layer from the list of layers.

Declaration
public void RemoveLayer(Layer layer)
Parameters
Type Name Description
Layer layer
Remarks

Removing a layer does not remove the Parts in the layer. Instead, those Parts are placed into the default layer. To remove all Parts in a layer you can call RemoveParts(IEnumerable<Part>, bool) with Parts as the argument.

You cannot remove the default layer, the one named with the empty string.

See Also

RemoveParts(IEnumerable<Part>, bool)

This method removes from this Diagram all of the Parts in a collection.

Declaration
public void RemoveParts(IEnumerable<Part> coll, bool check = false)
Parameters
Type Name Description
IEnumerable<Part> coll

A collection of Parts.

bool check

Whether to check CanDelete() on each part; default value is false.

Remarks

Removing a Node will also remove any Links that are connected with it. Removing a Group will also remove all of its members. Removing a Link will also remove all of its label Nodes, if it has any.

This does not perform a transaction nor does it raise a DiagramEvent. Call DeleteSelection(), which calls this method, if you want to delete all selected Parts. The DeleteSelection() command may delete other Parts as well, depending on DeletesTree.

At this time there is no "AddParts" method -- just call Add(Part) on each Part.

RequestUpdate(bool)

Usage of this method is uncommon and may affect performance, for efficiency do not call this method unless you have a well-defined need. Normally, Diagrams update automatically, and completeing a transaction ensures an immediate update.

Declaration
public virtual void RequestUpdate(bool alwaysQueueUpdate = false)
Parameters
Type Name Description
bool alwaysQueueUpdate

If true the Diagram will queue another update, even if an update is already occurring. The default value is false. Side effects in an "InitialLayoutCompleted" DiagramEvent listener might necessitate setting this parameter.

Remarks

The most common reason to call this method when the container has changed size but the window has not changed size, and the Diagram needs to be notified of this change. See an example of resizing diagrams here.

Requests that in the near-future the diagram makes sure all GraphObjects are arranged, recomputes the document bounds, updates the scrollbars, and redraws the viewport.

RollbackTransaction()

Rollback the current transaction, undoing any recorded changes.

Declaration
public bool RollbackTransaction()
Returns
Type Description
bool

the value returned by RollbackTransaction().

Remarks

This just calls RollbackTransaction().

Scroll(string, string, double)

Scrolling function used by primarily by CommandHandler's DoKeyDown().

Declaration
public void Scroll(string unit, string dir, double dist = 1)
Parameters
Type Name Description
string unit

A string representing the unit of the scroll operation. Can only be "pixel", "line", "page", or "document".

string dir

The direction of the scroll operation. Can only be "up", "down", "left", or "right".

double dist

An optional distance multiplier, for multiple pixels, lines, or pages. The default value is 1. This argument is ignored when the unit is "document".

See Also

ScrollToRect(Rect)

Modifies the Position to show a given Rect of the Diagram by centering the viewport on that Rect. Does nothing if the Rect is already entirely in view.

Declaration
public void ScrollToRect(Rect r)
Parameters
Type Name Description
Rect r
See Also

Select(Part)

Make the given object the only selected object.

Declaration
public void Select(Part part)
Parameters
Type Name Description
Part part

a Part that is already in a layer of this Diagram. If the value is null, this does nothing.

Remarks

Afterwards the Selection collection will have only the given part in it. This method raises the "ChangingSelection" and "ChangedSelection" Diagram events.

See Also

Select(IEnumerable<Part>)

Select all of the Parts supplied in the given collection, and deselect all other Parts.

Declaration
public void Select(IEnumerable<Part> coll)
Parameters
Type Name Description
IEnumerable<Part> coll

A collection of Parts to be selected.

Remarks

This method raises the "ChangingSelection" and "ChangedSelection" Diagram events.

See Also

StartTransaction(string)

Begin a transaction, where the changes are held by a Transaction object in the UndoManager.

Declaration
public bool StartTransaction(string tname = "")
Parameters
Type Name Description
string tname

a descriptive name for the transaction.

Returns
Type Description
bool

the value returned by StartTransaction(string).

Remarks

This just calls StartTransaction(string).

See Also

TransformDocToView(Point)

Given a Point in document coordinates, return a new Point in viewport coordinates.

Declaration
public Point TransformDocToView(Point p)
Parameters
Type Name Description
Point p
Returns
Type Description
Point

a new Point, the given Point converted into view coordinates.

See Also

TransformMousePoint(Point)

Takes a point in client coordinates and converts to document coordinates.

Declaration
public Point TransformMousePoint(Point pt)
Parameters
Type Name Description
Point pt
Returns
Type Description
Point

TransformViewToDoc(Point)

Given a point in viewport coordinates, return a new Point in document coordinates.

Declaration
public Point TransformViewToDoc(Point p)
Parameters
Type Name Description
Point p
Returns
Type Description
Point

a new Point, the given point converted into document coordinates.

See Also

UpdateAllRelationshipsFromData()

Add or remove any nodes or links according to additional or missing data objects in the model and update all of the references to nodes, in case they had been modified in the model without properly notifying the model by calling AddNodeData(TNodeData) or RemoveLinkData(TLinkData) or SetGroupKeyForNodeData(TNodeData, TNodeKey) or SetToKeyForLinkData(TLinkData, TNodeKey) or other similar methods.

Declaration
public void UpdateAllRelationshipsFromData()
Remarks

This method does not conduct a transaction, so you need to start and commit one yourself.

It is better to call AddNodeData(TNodeData), RemoveNodeData(TNodeData), AddLinkData(TLinkData), RemoveLinkData(TLinkData), Set(object, string, object), and other model methods to add/remove/modify data, because those methods will both record changes for undo/redo and will update all bindings that make depend on that property. Simply modifying the data and calling an "update..." method will not be able to record the previous value(s) of properties in the model data to support undo.

This only adds, removes, or updates the relationships between nodes and links, to have them reflect what is now declared in the model data. If you know which model data objects have been modified, it will be more efficient to update only the Parts that need it by calling UpdateRelationshipsFromData().

To update GraphObject properties that are data bound, call UpdateAllTargetBindings(string).

See Also

UpdateAllTargetBindings(string)

Update all of the data-bound properties of Nodes and Links in this diagram, without having to call Set(object, string, object).

Declaration
public void UpdateAllTargetBindings(string srcprop = "")
Parameters
Type Name Description
string srcprop

An optional source data property name: when provided, only evaluates those Bindings that use that particular property; when not provided or when it is the empty string, all bindings are evaluated.

Remarks

This copies/converts model data properties to set properties on Parts. This method does not conduct a transaction, so you need to start and commit one yourself.

It is better to call Set(object, string, object) to modify data properties, because that will both record changes for undo/redo and will update all bindings that make depend on that property. Simply modifying the data and calling an "Update..." method will not be able to record the previous value(s) of properties in the model data to support undo.

If you know which model data objects have been modified, it will be more efficient to update only the Parts that need it by calling UpdateTargetBindings(string).

To update relationships between nodes, call UpdateAllRelationshipsFromData().

See Also

UpdateScroll()

Method for resizing the canvas as well as the scrollbar helper divs.

Declaration
public bool UpdateScroll()
Returns
Type Description
bool

false if the canvas changed size, true if the canvas did not change size

UpdateViewport(Rect, Rect)

A special update called when only the viewport has been modified

Declaration
protected void UpdateViewport(Rect oldv, Rect newv)
Parameters
Type Name Description
Rect oldv

old viewport bounds.

Rect newv

new viewport bounds.

ZoomToFit()

Scales the Diagram to uniformly fit into the viewport. To have this done automatically, set the Diagram's AutoScale to Uniform.

Declaration
public void ZoomToFit()
Remarks

To animate ZoomToFit, use ZoomToFit().

See Also

ZoomToRect(Rect, AutoScale)

Modifies the Scale and Position of the Diagram so that the viewport displays a given document-coordinates rectangle.

Declaration
public void ZoomToRect(Rect r, AutoScale scaling = AutoScale.Uniform)
Parameters
Type Name Description
Rect r

rectangular bounds in document coordinates.

AutoScale scaling

an optional value of either Uniform (the default) or UniformToFill.

Events

AnimationFinished

Register or unregister an event handler that is called when a default animation just completed.

Declaration
public event EventHandler<DiagramEvent> AnimationFinished
Event Type
Type Description
EventHandler<DiagramEvent>

AnimationStarting

Register or unregister an event handler that is called when a default animation is about to start.

Declaration
public event EventHandler<DiagramEvent> AnimationStarting
Event Type
Type Description
EventHandler<DiagramEvent>

BackgroundContextClicked

Register or unregister an event handler that is called when a mouse right-button single-click happened in the background of the Diagram, not on a Part.

Declaration
public event EventHandler<DiagramEvent> BackgroundContextClicked
Event Type
Type Description
EventHandler<DiagramEvent>

BackgroundDoubleClicked

Register or unregister an event handler that is called when a mouse left-button double-click happened in the background of the Diagram, not on a Part.

Declaration
public event EventHandler<DiagramEvent> BackgroundDoubleClicked
Event Type
Type Description
EventHandler<DiagramEvent>

BackgroundSingleClicked

Register or unregister an event handler that is called when a mouse left-button single-click happened in the background of the Diagram, not on a Part.

Declaration
public event EventHandler<DiagramEvent> BackgroundSingleClicked
Event Type
Type Description
EventHandler<DiagramEvent>

Changed

Register or remove an event handler that is called when there is a ChangedEvent because this Diagram or one of its Parts has changed, but not because the Model or any model data has changed.

Declaration
public event EventHandler<ChangedEvent> Changed
Event Type
Type Description
EventHandler<ChangedEvent>
Remarks

It is unusual to listen for Diagram ChangedEvents -- it is far more common to listen for specific DiagramEvents by modifying the Diagram EventHandlers properties, or to listen for Model ChangedEvents (i.e. changes to the model) by adding to ModelChanged.

Do not add or remove Changed listeners during the execution of a Changed listener.

ChangedSelection

Register or unregister an event handler that is called when an operation has just changed the Diagram.Selection collection.

Declaration
public event EventHandler<DiagramEvent> ChangedSelection
Event Type
Type Description
EventHandler<DiagramEvent>

ChangingSelection

Register or unregister an event handler that is called when an operation is about to change the Diagram.Selection collection.

Declaration
public event EventHandler<DiagramEvent> ChangingSelection
Event Type
Type Description
EventHandler<DiagramEvent>

ClipboardChanged

Register or unregister an event handler that is called when Parts have been copied to the clipboard by CommandHandler.CopySelection.

Declaration
public event EventHandler<DiagramEvent> ClipboardChanged
Event Type
Type Description
EventHandler<DiagramEvent>

ClipboardPasted

Register or unregister an event handler that is called when Parts have been copied from the clipboard into the Diagram by CommandHandler.PasteSelection.

Declaration
public event EventHandler<DiagramEvent> ClipboardPasted
Event Type
Type Description
EventHandler<DiagramEvent>

DocumentBoundsChanged

Register or unregister an event handler that is called when the area of the diagram's Parts, Diagram.DocumentBounds, has changed.

Declaration
public event EventHandler<DiagramEvent> DocumentBoundsChanged
Event Type
Type Description
EventHandler<DiagramEvent>

ElementContextClicked

Register or unregister an event handler that is called when a context-click that occurred on a GraphObject.

Declaration
public event EventHandler<DiagramEvent> ElementContextClicked
Event Type
Type Description
EventHandler<DiagramEvent>

ElementDoubleClicked

Register or unregister an event handler that is called when a double-click that occurred on a GraphObject.

Declaration
public event EventHandler<DiagramEvent> ElementDoubleClicked
Event Type
Type Description
EventHandler<DiagramEvent>

ElementSingleClicked

Register or unregister an event handler that is called when a click that occurred on a GraphObject.

Declaration
public event EventHandler<DiagramEvent> ElementSingleClicked
Event Type
Type Description
EventHandler<DiagramEvent>

ExternalElementsDropped

Register or unregister an event handler that is called when Parts have been copied into the Diagram by drag-and-drop from outside of the Diagram.

Declaration
public event EventHandler<DiagramEvent> ExternalElementsDropped
Event Type
Type Description
EventHandler<DiagramEvent>

GainedFocus

Register or unregister an event handler that is called when the diagram has gained keyboard focus, such as after a call to Diagram.Focus.

Declaration
public event EventHandler<DiagramEvent> GainedFocus
Event Type
Type Description
EventHandler<DiagramEvent>

InitialAnimationStarting

Register or unregister an event handler that is called when the initial default animation is about to start.

Declaration
public event EventHandler<DiagramEvent> InitialAnimationStarting
Event Type
Type Description
EventHandler<DiagramEvent>

InitialLayoutCompleted

Register or unregister an event handler that is called when the whole diagram layout has updated for the first time since a major change to the Diagram, such as replacing the Model.

Declaration
public event EventHandler<DiagramEvent> InitialLayoutCompleted
Event Type
Type Description
EventHandler<DiagramEvent>

LayoutCompleted

Register or unregister an event handler that is called when the whole diagram layout has just been updated.

Declaration
public event EventHandler<DiagramEvent> LayoutCompleted
Event Type
Type Description
EventHandler<DiagramEvent>

LinkDrawn

Register or unregister an event handler that is called when the user has just created a new Link using LinkingTool.

Declaration
public event EventHandler<DiagramEvent> LinkDrawn
Event Type
Type Description
EventHandler<DiagramEvent>

LinkRelinked

Register or unregister an event handler that is called when the user has just reconnected an existing Link using RelinkingTool or DraggingTool.

Declaration
public event EventHandler<DiagramEvent> LinkRelinked
Event Type
Type Description
EventHandler<DiagramEvent>

LinkReshaped

Register or unregister an event handler that is called when the user has just rerouted an existing Link using LinkReshapingTool.

Declaration
public event EventHandler<DiagramEvent> LinkReshaped
Event Type
Type Description
EventHandler<DiagramEvent>

LostFocus

Register or unregister an event handler that is called when the diagram has lost keyboard focus ("blur").

Declaration
public event EventHandler<DiagramEvent> LostFocus
Event Type
Type Description
EventHandler<DiagramEvent>

ModelChanged

Register or remove an event handler on this Diagram's Model that is called when there is a ChangedEvent on the Model<TNodeData, TNodeKey, TSharedData>, not in this diagram. Be sure to remove event handlers when you are done with the diagram.

Declaration
public event EventHandler<ChangedEvent> ModelChanged
Event Type
Type Description
EventHandler<ChangedEvent>
Remarks

This is convenient when the Model may be replaced. Using this method to register a Model Changed listener is more convenient than adding to Changed directly because when this diagram's Model is replaced, one does not need to remove handlers on the old Model and then add them again on the new Model.

Do not add or remove Changed listeners during the execution of a Changed listener.

Modified

Register or unregister an event handler that is called when the Diagram.IsModified property has been set to a new value.

Declaration
public event EventHandler<DiagramEvent> Modified
Event Type
Type Description
EventHandler<DiagramEvent>

PartCreated

Register or unregister an event handler that is called when the user inserted a new Part by ClickCreatingTool.

Declaration
public event EventHandler<DiagramEvent> PartCreated
Event Type
Type Description
EventHandler<DiagramEvent>

PartResized

Register or unregister an event handler that is called when the user has changed the size of a GraphObject by ResizingTool.

Declaration
public event EventHandler<DiagramEvent> PartResized
Event Type
Type Description
EventHandler<DiagramEvent>

PartRotated

Register or unregister an event handler that is called when the user has changed the angle of a GraphObject by RotatingTool.

Declaration
public event EventHandler<DiagramEvent> PartRotated
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionCopied

Register or unregister an event handler that is called when the user has copied selected Parts by DraggingTool.

Declaration
public event EventHandler<DiagramEvent> SelectionCopied
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionDeleted

Register or unregister an event handler that is called when the user has deleted selected Parts by CommandHandler.DeleteSelection.

Declaration
public event EventHandler<DiagramEvent> SelectionDeleted
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionDeleting

Register or unregister an event handler that is called when the user is about to delete selected Parts by CommandHandler.DeleteSelection.

Declaration
public event EventHandler<DiagramEvent> SelectionDeleting
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionGrouped

Register or unregister an event handler that is called when the user has made a new Group out of the selected Parts by CommandHandler.GroupSelection.

Declaration
public event EventHandler<DiagramEvent> SelectionGrouped
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionMoved

Register or unregister an event handler that is called when the user has moved selected Parts by DraggingTool.

Declaration
public event EventHandler<DiagramEvent> SelectionMoved
Event Type
Type Description
EventHandler<DiagramEvent>

SelectionUngrouped

Register or unregister an event handler that is called when the user has removed a selected Group but kept its members by CommandHandler.UngroupSelection.

Declaration
public event EventHandler<DiagramEvent> SelectionUngrouped
Event Type
Type Description
EventHandler<DiagramEvent>

SubGraphCollapsed

Register or unregister an event handler that is called when the user has collapsed selected Groups by CommandHandler.CollapseSubGraph.

Declaration
public event EventHandler<DiagramEvent> SubGraphCollapsed
Event Type
Type Description
EventHandler<DiagramEvent>

SubGraphExpanded

Register or unregister an event handler that is called when the user has expanded selected Groups by CommandHandler.ExpandSubGraph.

Declaration
public event EventHandler<DiagramEvent> SubGraphExpanded
Event Type
Type Description
EventHandler<DiagramEvent>

TextEdited

Register or unregister an event handler that is called when the user has changed the string value of a TextBlock by TextEditingTool.

Declaration
public event EventHandler<DiagramEvent> TextEdited
Event Type
Type Description
EventHandler<DiagramEvent>

TreeCollapsed

Register or unregister an event handler that is called when the user has collapsed selected Nodes with subtrees by CommandHandler.CollapseTree.

Declaration
public event EventHandler<DiagramEvent> TreeCollapsed
Event Type
Type Description
EventHandler<DiagramEvent>

TreeExpanded

Register or unregister an event handler that is called when the user has expanded selected Nodes with subtrees by CommandHandler.ExpandTree.

Declaration
public event EventHandler<DiagramEvent> TreeExpanded
Event Type
Type Description
EventHandler<DiagramEvent>

ViewportBoundsChanged

Register or unregister an event handler that is called when the visible area of the Diagram, Diagram.ViewportBounds, has changed.

Declaration
public event EventHandler<DiagramEvent> ViewportBoundsChanged
Event Type
Type Description
EventHandler<DiagramEvent>

Implements