Class
GraphController

Main MVC controller. The view type is based on an interface in function of platform independence.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Syntax:

cs-api-definition
public sealed class GraphController : IControllerService, ISerializable

Inheritance: objectGraphController

Implements: IControllerServiceISerializable

Constructors

GraphController(IGraphInternal, IContainerGeneratorInternal)

Initializes a new instance of the GraphController class.

Declaration

cs-api-definition
public GraphController(IGraphInternal graph, IContainerGeneratorInternal containerGenerator)

Parameters

graph

IGraphInternal

The graph internal.

containerGenerator

IContainerGeneratorInternal

The container generator.

Properties

ServiceLocator

Gets the service locator.

Declaration

cs-api-definition
public ServiceLocator ServiceLocator { get; }

Property Value

ServiceLocator

Methods

ActivateTool(MouseTool)

Activates the tool.

Declaration

cs-api-definition
public void ActivateTool(MouseTool mouseTool)

Parameters

mouseTool

MouseTool

The mouse tool.

AddConnection(IConnection, bool)

Adds the connection.

Declaration

cs-api-definition
public void AddConnection(IConnection connection, bool isUndoable = true)

Parameters

connection

IConnection

The connection.

isUndoable

bool

If set to true [is undoable].

AddShape(IShape, bool)

Adds the shape.

Declaration

cs-api-definition
public void AddShape(IShape shape, bool isUndoable = true)

Parameters

shape

IShape

The shape.

isUndoable

bool

If set to true [is undoable].

AddShape(object, bool)

Adds the shape.

Declaration

cs-api-definition
public IShape AddShape(object item, bool isUndoable = true)

Parameters

item

object

The item.

isUndoable

bool

If set to true [is undoable].

Returns

IShape

Exceptions

ArgumentNullException

If the item is null.

AlignShapes(Alignment, IEnumerable<IShape>)

Aligns the shapes to the most left/top/right/bottom edge defined by the selection bounds.

Declaration

cs-api-definition
public void AlignShapes(Alignment alignment, IEnumerable<IShape> shapes)

Parameters

alignment

Alignment

Determines whether alignment should be calculated towards left/top/right/bottom edge.

shapes

IEnumerable<IShape>

The shapes.

BringForward(IEnumerable<IDiagramItem>, bool)

Brings the selected items forward.

Declaration

cs-api-definition
public void BringForward(IEnumerable<IDiagramItem> items, bool isUndoable = true)

Parameters

items

IEnumerable<IDiagramItem>

isUndoable

bool

BringToFront(IEnumerable<IDiagramItem>, bool)

Brings the selected items to front.

Declaration

cs-api-definition
public void BringToFront(IEnumerable<IDiagramItem> items, bool isUndoable = true)

Parameters

items

IEnumerable<IDiagramItem>

isUndoable

bool

ChangeTool(string)

Changes the tool.

Declaration

cs-api-definition
public void ChangeTool(string toolName)

Parameters

toolName

string

Label of the tool.

Clear(bool)

Clears the diagram and resets the document.

Declaration

cs-api-definition
public void Clear(bool isItemsCollectionChanging = false)

Parameters

isItemsCollectionChanging

bool

Remarks

The diagram is not saved prior to this reset. You need to handle in the application the eventual necessity to save (or request the user) the diagram before this.

ClearConnections()

Clears the connections.

Declaration

cs-api-definition
public void ClearConnections()

ClearShapes()

Clears the shapes.

Declaration

cs-api-definition
public void ClearShapes()

Copy()

Creates a copy of the diagram in the clipboard.

Declaration

cs-api-definition
public string Copy()

Returns

string

CreateConnection(IShape, IShape, bool)

Creates the connection.

Declaration

cs-api-definition
public IConnection CreateConnection(IShape source, IShape target, bool isUndoable)

Parameters

source

IShape

The source.

target

IShape

The target.

isUndoable

bool

If set to true [is undoable].

Returns

IConnection

CreateConnectionInGraphSource(IShape, IShape)

Creates the connection in graph source.

Declaration

cs-api-definition
public ILink CreateConnectionInGraphSource(IShape source, IShape target)

Parameters

source

IShape

The source.

target

IShape

The target.

Returns

ILink

CreateShapeInGraphSource(IShape)

Creates the shape in graph source.

Declaration

cs-api-definition
public object CreateShapeInGraphSource(IShape shape)

Parameters

shape

IShape

The shape.

Returns

object

CutItems()

Cuts the items.

Declaration

cs-api-definition
public string CutItems()

Returns

string

DeleteItems(IEnumerable<IDiagramItem>, bool)

Deletes the items.

Declaration

cs-api-definition
public void DeleteItems(IEnumerable<IDiagramItem> itemsToDelete, bool isUndoable)

Parameters

itemsToDelete

IEnumerable<IDiagramItem>

The items to delete.

isUndoable

bool

If set to true [is undoable].

DeselectItem(IDiagramItem)

Deselects a specific item.

Declaration

cs-api-definition
public void DeselectItem(IDiagramItem deselectedItem)

Parameters

deselectedItem

IDiagramItem

Deserialize(SerializationInfo)

Deserializes the specified info.

Declaration

cs-api-definition
public void Deserialize(SerializationInfo info)

Parameters

info

SerializationInfo

The info.

Implements ISerializable.Deserialize(SerializationInfo)

ForceRealization()

Forces the realization.

Declaration

cs-api-definition
public void ForceRealization()

Group(string, bool, params IGroupable[])

Groups the selected shapes.

Declaration

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

Parameters

name

string

The name.

isUndoable

bool

If set to true the operation [is undoable].

items

IGroupable[]

The items.

Returns

IGroup

IsInViewport(IDiagramItem)

Checks if the diagram item is in the viewport.

Declaration

cs-api-definition
public bool IsInViewport(IDiagramItem item)

Parameters

item

IDiagramItem

Returns

bool

KeyDown(KeyArgs)

Called when key down event is fired.

Declaration

cs-api-definition
public bool KeyDown(KeyArgs e)

Parameters

e

KeyArgs

The key args.

Returns

bool

KeyUp(KeyArgs)

Called when key up event is fired.

Declaration

cs-api-definition
public bool KeyUp(KeyArgs e)

Parameters

e

KeyArgs

The key args.

Returns

bool

Layout(LayoutType, object)

Organizes the diagram using the specified layout.

Declaration

cs-api-definition
public void Layout(LayoutType type = LayoutType.Sugiyama, object settings = null)

Parameters

type

LayoutType

The layout type to apply.

settings

object

The settings specific to the layout type.

Load(string)

Loads the serialized diagram.

Declaration

cs-api-definition
public void Load(string serializationValue)

Parameters

serializationValue

string

A string supposedly containing some XML representing a serialized diagram.

MergeItems(IEnumerable<IDiagramItem>, string, bool, Point, Size)

Merges the items in the diagram.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
public IEnumerable<IDiagramItem> MergeItems(IEnumerable<IDiagramItem> items, string originId, bool usePosition = false, Point position = null, Size size = null)

Parameters

items

IEnumerable<IDiagramItem>

The items.

originId

string

The origin id.

usePosition

bool

If set to true the given position will be used.

position

Point

The position.

size

Size

The size.

Returns

IEnumerable<IDiagramItem>

MouseDoubleClick(PointerArgs)

Handles the mouse double click event.

Declaration

cs-api-definition
public void MouseDoubleClick(PointerArgs e)

Parameters

e

PointerArgs

The e.

MouseDown(PointerArgs)

Called when the left mouse button is down.

Declaration

cs-api-definition
public void MouseDown(PointerArgs e)

Parameters

e

PointerArgs

The e.

MouseMove(PointerArgs)

Called when the mouse moves.

Declaration

cs-api-definition
public void MouseMove(PointerArgs e)

Parameters

e

PointerArgs

The e.

MouseUp(PointerArgs)

Called when the mouse left button is up.

Declaration

cs-api-definition
public void MouseUp(PointerArgs e)

Parameters

e

PointerArgs

The e.

Nudge(Point)

Nudges (i.e. a small amount of translation) the selected items with the specified amount.

Declaration

cs-api-definition
public void Nudge(Point amount)

Parameters

amount

Point

The amount defined as a point (vector).

Remarks

This is an undoable action and plugs into the same mechanism as the DraggingTool.

OnGraphSourceChanged(IGraphSource)

Called when graph source changes.

Declaration

cs-api-definition
public void OnGraphSourceChanged(IGraphSource source)

Parameters

source

IGraphSource

The source.

OnItemsChanged(NotifyCollectionChangedEventArgs)

Called when Items collection changes.

Declaration

cs-api-definition
public void OnItemsChanged(NotifyCollectionChangedEventArgs e)

Parameters

e

NotifyCollectionChangedEventArgs

The NotifyCollectionChangedEventArgs instance containing the event data.

OnViewportChanged()

Called when the bounds have changed.

Declaration

cs-api-definition
public void OnViewportChanged()

Paste(string)

Pastes a diagram, serialized in the clipboard.

Declaration

cs-api-definition
public IEnumerable<IDiagramItem> Paste(string pasteText)

Parameters

pasteText

string

Returns

IEnumerable<IDiagramItem>

RemoveConnection(IConnection, bool)

Removes the connection.

Declaration

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

Parameters

connection

IConnection

The connection.

isUndoable

bool

If set to true [is undoable].

RemoveShape(IShape, bool)

Removes the shape from the diagram.

Declaration

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

Parameters

shape

IShape

The shape to be removed.

isUndoable

bool

If set to true the action will be recorded in the undo stack.

Save()

Returns the serialized diagram as an XML-string.

Declaration

cs-api-definition
public string Save()

Returns

string

SelectItem(IDiagramItem, bool)

Selects a specific item.

Declaration

cs-api-definition
public void SelectItem(IDiagramItem selectedItem, bool addToExistingSelection = false)

Parameters

selectedItem

IDiagramItem

addToExistingSelection

bool

SendBackward(IEnumerable<IDiagramItem>, bool)

Sends selected items backward.

Declaration

cs-api-definition
public void SendBackward(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)

Parameters

itemsToSend

IEnumerable<IDiagramItem>

isUndoable

bool

SendToBack(IEnumerable<IDiagramItem>, bool)

Sends selected items to back.

Declaration

cs-api-definition
public void SendToBack(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)

Parameters

itemsToSend

IEnumerable<IDiagramItem>

isUndoable

bool

Serialize()

Serializes this instance.

Declaration

cs-api-definition
public SerializationInfo Serialize()

Returns

SerializationInfo

Implements ISerializable.Serialize()

SnapShapes(IEnumerable<IShape>)

Snaps the items based on the snap value. The action is enclosed in a undoable command and supports undo/redo.

Declaration

cs-api-definition
public void SnapShapes(IEnumerable<IShape> shapes)

Parameters

shapes

IEnumerable<IShape>

Ungroup(bool, params IGroup[])

Ungroups the specified items.

Declaration

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

Parameters

isUndoable

bool

groups

IGroup[]