Interface
IGraph

Defines the diagramming control's API.

Definition

Properties

Connections

Gets the connections in the current diagram.

Declaration

cs-api-definition
ConnectionCollection Connections { get; }

Property Value

ConnectionCollection

Cursor

Gets or sets the current cursor.

Declaration

cs-api-definition
Cursor Cursor { get; set; }

Property Value

Cursor

GraphSource

Gets or sets the MVVM source of the diagram.

Declaration

cs-api-definition
IGraphSource GraphSource { get; set; }

Property Value

IGraphSource

Groups

Gets the groups in the current diagram.

Declaration

cs-api-definition
IEnumerable<IGroup> Groups { get; }

Property Value

IEnumerable<IGroup>

IgnoreLinkDirection

Gets or sets a value indicating whether the underlying graph structure is a directional graph (aka digraph).

Declaration

cs-api-definition
bool IgnoreLinkDirection { get; set; }

Property Value

bool

True if link directions are ignored; otherwise, false.

IsBackgroundSurfaceVisible

Gets or sets a value indicating whether the background visual is visible.

Declaration

cs-api-definition
bool IsBackgroundSurfaceVisible { get; set; }

Property Value

bool

True if the grid is visible; otherwise, false.

IsEditable

Gets or sets a value indicating whether editing is enabled.

Declaration

cs-api-definition
bool IsEditable { get; set; }

Property Value

bool

True if editing is enabled; otherwise, false.

Remarks

Note that the similar lower-level IsEditable will be overruled by this setting.

IsMouseCaptured

Gets or sets whether the control has currently captured the mouse pointer.

Declaration

cs-api-definition
bool IsMouseCaptured { get; set; }

Property Value

bool

True if this instance is mouse captured; otherwise, false.

IsPanEnabled

Gets or sets a value indicating whether panning is enabled.

Declaration

cs-api-definition
bool IsPanEnabled { get; set; }

Property Value

bool

True if panning is enabled; otherwise, false.

IsSnapToGridEnabled

Gets or sets a value indicating whether snapping is enabled.

Declaration

cs-api-definition
bool IsSnapToGridEnabled { get; set; }

Property Value

bool

True if snapping is enabled; otherwise, false.

IsSnapToItemsEnabled

Gets or sets a value indicating whether snapping of selected item(s) to the other items in the view port is enabled or not.

Declaration

cs-api-definition
bool IsSnapToItemsEnabled { get; set; }

Property Value

bool

IsVirtualizing

Gets a value indicating whether virtualization is switched on.

Declaration

cs-api-definition
bool IsVirtualizing { get; }

Property Value

bool

True if this instance is virtualizing; otherwise, false.

IsZoomEnabled

Gets or sets a value indicating whether zooming is enabled.

Declaration

cs-api-definition
bool IsZoomEnabled { get; set; }

Property Value

bool

True if zooming is enabled; otherwise, false.

Items

Gets all (shapes and connections) the diagram items.

Declaration

cs-api-definition
DiagramItemCollection Items { get; }

Property Value

DiagramItemCollection

Metadata

Gets the metadata of the diagram.

Declaration

cs-api-definition
DiagramMetadata Metadata { get; }

Property Value

DiagramMetadata

Position

Gets or sets the panning position.

Declaration

cs-api-definition
Point Position { get; set; }

Property Value

Point

RectSelectionMode

Gets or sets whether items are selected if they are fully or partially contained in the selection rectangle.

Declaration

cs-api-definition
RectSelectionMode RectSelectionMode { get; set; }

Property Value

RectSelectionMode

SelectionMode

Gets or sets the selection mode, i.e. how elements are being selected in responds to the overlap of a shape's bounds and the selection rectangle.

Declaration

cs-api-definition
SelectionMode SelectionMode { get; set; }

Property Value

SelectionMode

Shapes

Gets the shapes of the current diagram.

Declaration

cs-api-definition
ShapeCollection Shapes { get; }

Property Value

ShapeCollection

SnapX

Gets or sets the horizontal snap value.

Declaration

cs-api-definition
int SnapX { get; set; }

Property Value

int

SnapY

Gets or sets the vertical snap value.

Declaration

cs-api-definition
int SnapY { get; set; }

Property Value

int

Viewport

Gets the viewport rectangle.

Declaration

cs-api-definition
Rect Viewport { get; }

Property Value

Rect

Zoom

Gets or sets the zoom level.

Declaration

cs-api-definition
double Zoom { get; set; }

Property Value

double

Remarks

The default zoom level of 100% corresponds to a Zoom value of 1d. Values bigger than one will zoom into the diagram while values smaller than one will zoom out.

Methods

AddConnection(IConnection, bool)

Adds a new connection to the diagram.

Declaration

cs-api-definition
IConnection AddConnection(IConnection connection, bool isUndoable = false)

Parameters

connection

IConnection

The connection to be added.

isUndoable

bool

If set to true the addition will be recorded as undoable.

Returns

IConnection

AddConnection(IShape, IShape, bool)

Adds a connection to the diagram.

Declaration

cs-api-definition
IConnection AddConnection(IShape source, IShape target, bool isUndoable = false)

Parameters

source

IShape

The source shape of this connection.

target

IShape

The target shape of this connection.

isUndoable

bool

If set to true the addition will be recorded as undoable.

Returns

IConnection

AddConnection(Point, Point, bool)

Adds a floating connection to the diagram.

Declaration

cs-api-definition
IConnection AddConnection(Point startPoint, Point endPoint, bool isUndoable = false)

Parameters

startPoint

Point

The source (starting) point of the connection.

endPoint

Point

The target (end) point of the connection.

isUndoable

bool

True, if this action is undoable.

Returns

IConnection

Returns the added connection.

Remarks

A floating connection is a connection which is not necessarily at its source or target attached to a shape.

AddShape(IShape, Point?, bool)

Adds a new shape to the diagram.

Declaration

cs-api-definition
IShape AddShape(IShape shape, Point? position = null, bool isUndoable = false)

Parameters

shape

IShape

The shape to add.

position

Point?

The position at which the newly created shape should be positioned.

isUndoable

bool

If set to true the addition will be recorded as undoable.

Returns

IShape

BeginBatchTransformation()

Begins a batch transformation and signals the undo-redo stack that a batch of transformation should be considered as one, i.e. a composite change.

Declaration

cs-api-definition
DiagramLayoutState BeginBatchTransformation()

Returns

DiagramLayoutState

CommitBatchTransformation(DiagramLayoutState, DiagramLayoutState, bool, bool, LayoutType, object)

Commits the batch transformation and ends the composite undo redo change.

Declaration

cs-api-definition
void CommitBatchTransformation(DiagramLayoutState initialState, DiagramLayoutState finalState, bool animate, bool execute, LayoutType type = LayoutType.Sugiyama, object settings = null)

Parameters

initialState

DiagramLayoutState

The initial state.

finalState

DiagramLayoutState

The final state of the shapes after layout.

animate

bool

If set to true the layout transition will be animated.

execute

bool

If true the batch will be executed, otherwise only the undo units will be added.

type

LayoutType

The layout type that has been applied.

settings

object

The layout specific settings used for the layout.

Group(string, bool, params IGroupable[])

Groups the given items in a new group with the specified name.

Declaration

cs-api-definition
IGroup Group(string groupName = null, bool isUndoable = false, params IGroupable[] items)

Parameters

groupName

string

Name of the group.

isUndoable

bool

If set to true the operation [is undoable].

items

IGroupable[]

The items to be grouped.

Returns

IGroup

Group(string, params IGroupable[])

Groups the given items in a new group with the specified name.

Declaration

cs-api-definition
IGroup Group(string groupName = null, params IGroupable[] items)

Parameters

groupName

string

Name of the group.

items

IGroupable[]

The items to be grouped.

Returns

IGroup

RemoveConnection(IConnection, bool)

Removes a connection from the diagram.

Declaration

cs-api-definition
void RemoveConnection(IConnection connection, bool isUndoable = false)

Parameters

connection

IConnection

The connection to be removed.

isUndoable

bool

If set to true the addition will be recorded as undoable.

RemoveShape(IShape, bool)

Removes a shape from the diagram.

Declaration

cs-api-definition
void RemoveShape(IShape shape, bool isUndoable = false)

Parameters

shape

IShape

The shape to be removed.

isUndoable

bool

If set to true the addition will be recorded as undoable.

Ungroup(bool, params IGroup[])

Ungroups the specified groups.

Declaration

cs-api-definition
void Ungroup(bool isUndoable = false, params IGroup[] groups)

Parameters

isUndoable

bool

If set to true the operation [is undoable].

groups

IGroup[]

The groups.

Ungroup(params IGroup[])

Ungroups the specified groups.

Declaration

cs-api-definition
void Ungroup(params IGroup[] groups)

Parameters

groups

IGroup[]

The groups.

Extension Methods