New to Telerik UI for WPFStart a free 30-day trial

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:

C#
public sealed class GraphController : IControllerService, ISerializable

Inheritance: objectGraphController

Implements: IControllerServiceISerializable

Constructors

Initializes a new instance of the GraphController class.

C#
public GraphController(IGraphInternal graph, IContainerGeneratorInternal containerGenerator)
Parameters:graphIGraphInternal

The graph internal.

containerGeneratorIContainerGeneratorInternal

The container generator.

Properties

Gets the service locator.

C#
public ServiceLocator ServiceLocator { get; }

Methods

Activates the tool.

C#
public void ActivateTool(MouseTool mouseTool)
Parameters:mouseToolMouseTool

The mouse tool.

Adds the connection.

C#
public void AddConnection(IConnection connection, bool isUndoable = true)
Parameters:connectionIConnection

The connection.

isUndoablebool

If set to true [is undoable].

Adds the shape.

C#
public void AddShape(IShape shape, bool isUndoable = true)
Parameters:shapeIShape

The shape.

isUndoablebool

If set to true [is undoable].

Adds the shape.

C#
public IShape AddShape(object item, bool isUndoable = true)
Parameters:itemobject

The item.

isUndoablebool

If set to true [is undoable].

Returns:

IShape

Exceptions:

ArgumentNullException

If the item is null.

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

C#
public void AlignShapes(Alignment alignment, IEnumerable<IShape> shapes)
Parameters:alignmentAlignment

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

shapesIEnumerable<IShape>

The shapes.

Brings the selected items forward.

C#
public void BringForward(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters:itemsIEnumerable<IDiagramItem>isUndoablebool

Brings the selected items to front.

C#
public void BringToFront(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters:itemsIEnumerable<IDiagramItem>isUndoablebool

Changes the tool.

C#
public void ChangeTool(string toolName)
Parameters:toolNamestring

Label of the tool.

Clears the diagram and resets the document.

C#
public void Clear(bool isItemsCollectionChanging = false)
Parameters:isItemsCollectionChangingbool
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.

Clears the connections.

C#
public void ClearConnections()

Clears the shapes.

C#
public void ClearShapes()

Creates a copy of the diagram in the clipboard.

C#
public string Copy()
Returns:

string

Creates the connection.

C#
public IConnection CreateConnection(IShape source, IShape target, bool isUndoable)
Parameters:sourceIShape

The source.

targetIShape

The target.

isUndoablebool

If set to true [is undoable].

Returns:

IConnection

Creates the connection in graph source.

C#
public ILink CreateConnectionInGraphSource(IShape source, IShape target)
Parameters:sourceIShape

The source.

targetIShape

The target.

Returns:

ILink

Creates the shape in graph source.

C#
public object CreateShapeInGraphSource(IShape shape)
Parameters:shapeIShape

The shape.

Returns:

object

Cuts the items.

C#
public string CutItems()
Returns:

string

Deletes the items.

C#
public void DeleteItems(IEnumerable<IDiagramItem> itemsToDelete, bool isUndoable)
Parameters:itemsToDeleteIEnumerable<IDiagramItem>

The items to delete.

isUndoablebool

If set to true [is undoable].

Deselects a specific item.

C#
public void DeselectItem(IDiagramItem deselectedItem)
Parameters:deselectedItemIDiagramItem

Deserializes the specified info.

C#
public void Deserialize(SerializationInfo info)
Parameters:infoSerializationInfo

The info.

Implements: ISerializable.Deserialize(SerializationInfo)

Forces the realization.

C#
public void ForceRealization()

Groups the selected shapes.

C#
public IGroup Group(string name = null, bool isUndoable = false, params IGroupable[] items)
Parameters:namestring

The name.

isUndoablebool

If set to true the operation [is undoable].

itemsIGroupable[]

The items.

Returns:

IGroup

Checks if the diagram item is in the viewport.

C#
public bool IsInViewport(IDiagramItem item)
Parameters:itemIDiagramItemReturns:

bool

Called when key down event is fired.

C#
public bool KeyDown(KeyArgs e)
Parameters:eKeyArgs

The key args.

Returns:

bool

Called when key up event is fired.

C#
public bool KeyUp(KeyArgs e)
Parameters:eKeyArgs

The key args.

Returns:

bool

Organizes the diagram using the specified layout.

C#
public void Layout(LayoutType type = LayoutType.Sugiyama, object settings = null)
Parameters:typeLayoutType

The layout type to apply.

settingsobject

The settings specific to the layout type.

Loads the serialized diagram.

C#
public void Load(string serializationValue)
Parameters:serializationValuestring

A string supposedly containing some XML representing a serialized diagram.

Merges the items in the diagram.

C#
public IEnumerable<IDiagramItem> MergeItems(IEnumerable<IDiagramItem> items, string originId, bool usePosition = false, Point position = null, Size size = null)
Parameters:itemsIEnumerable<IDiagramItem>

The items.

originIdstring

The origin id.

usePositionbool

If set to true the given position will be used.

positionPoint

The position.

sizeSize

The size.

Returns:

IEnumerable<IDiagramItem>

Handles the mouse double click event.

C#
public void MouseDoubleClick(PointerArgs e)
Parameters:ePointerArgs

The e.

Called when the left mouse button is down.

C#
public void MouseDown(PointerArgs e)
Parameters:ePointerArgs

The e.

Called when the mouse moves.

C#
public void MouseMove(PointerArgs e)
Parameters:ePointerArgs

The e.

Called when the mouse left button is up.

C#
public void MouseUp(PointerArgs e)
Parameters:ePointerArgs

The e.

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

C#
public void Nudge(Point amount)
Parameters:amountPoint

The amount defined as a point (vector).

Remarks:

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

Called when graph source changes.

C#
public void OnGraphSourceChanged(IGraphSource source)
Parameters:sourceIGraphSource

The source.

Called when Items collection changes.

C#
public void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters:eNotifyCollectionChangedEventArgs

The NotifyCollectionChangedEventArgs instance containing the event data.

Called when the bounds have changed.

C#
public void OnViewportChanged()

Pastes a diagram, serialized in the clipboard.

C#
public IEnumerable<IDiagramItem> Paste(string pasteText)
Parameters:pasteTextstringReturns:

IEnumerable<IDiagramItem>

Removes the connection.

C#
public void RemoveConnection(IConnection connection, bool isUndoable = false)
Parameters:connectionIConnection

The connection.

isUndoablebool

If set to true [is undoable].

Removes the shape from the diagram.

C#
public void RemoveShape(IShape shape, bool isUndoable = false)
Parameters:shapeIShape

The shape to be removed.

isUndoablebool

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

Returns the serialized diagram as an XML-string.

C#
public string Save()
Returns:

string

Selects a specific item.

C#
public void SelectItem(IDiagramItem selectedItem, bool addToExistingSelection = false)
Parameters:selectedItemIDiagramItemaddToExistingSelectionbool

Sends selected items backward.

C#
public void SendBackward(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters:itemsToSendIEnumerable<IDiagramItem>isUndoablebool

Sends selected items to back.

C#
public void SendToBack(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters:itemsToSendIEnumerable<IDiagramItem>isUndoablebool

Serializes this instance.

C#
public SerializationInfo Serialize()
Returns:

SerializationInfo

Implements: ISerializable.Serialize()

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

C#
public void SnapShapes(IEnumerable<IShape> shapes)
Parameters:shapesIEnumerable<IShape>

Ungroups the specified items.

C#
public void Ungroup(bool isUndoable = false, params IGroup[] groups)
Parameters:isUndoableboolgroupsIGroup[]