ClassGraphController
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:
public sealed class GraphController : IControllerService, ISerializable
Inheritance: objectGraphController
Implements:
Constructors
GraphController(IGraphInternal, IContainerGeneratorInternal)
Initializes a new instance of the GraphController class.
Declaration
public GraphController(IGraphInternal graph, IContainerGeneratorInternal containerGenerator)
Parameters
graph
The graph internal.
containerGenerator
The container generator.
Properties
ServiceLocator
Gets the service locator.
Declaration
public ServiceLocator ServiceLocator { get; }
Property Value
Methods
ActivateTool(MouseTool)
Activates the tool.
Declaration
public void ActivateTool(MouseTool mouseTool)
Parameters
mouseTool
The mouse tool.
AddConnection(IConnection, bool)
Adds the connection.
Declaration
public void AddConnection(IConnection connection, bool isUndoable = true)
Parameters
connection
The connection.
isUndoable
If set to true [is undoable].
AddShape(IShape, bool)
Adds the shape.
AddShape(object, bool)
Adds the shape.
Declaration
public IShape AddShape(object item, bool isUndoable = true)
Parameters
item
The item.
isUndoable
If set to true [is undoable].
Returns
Exceptions
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
public void AlignShapes(Alignment alignment, IEnumerable<IShape> shapes)
Parameters
alignment
Determines whether alignment should be calculated towards left/top/right/bottom edge.
shapes
The shapes.
BringForward(IEnumerable<IDiagramItem>, bool)
Brings the selected items forward.
Declaration
public void BringForward(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters
items
isUndoable
BringToFront(IEnumerable<IDiagramItem>, bool)
Brings the selected items to front.
Declaration
public void BringToFront(IEnumerable<IDiagramItem> items, bool isUndoable = true)
Parameters
items
isUndoable
ChangeTool(string)
Changes the tool.
Declaration
public void ChangeTool(string toolName)
Parameters
toolName
Label of the tool.
Clear(bool)
Clears the diagram and resets the document.
Declaration
public void Clear(bool isItemsCollectionChanging = false)
Parameters
isItemsCollectionChanging
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
public void ClearConnections()
Copy()
Creates a copy of the diagram in the clipboard.
CreateConnection(IShape, IShape, bool)
Creates the connection.
Declaration
public IConnection CreateConnection(IShape source, IShape target, bool isUndoable)
Parameters
source
The source.
target
The target.
isUndoable
If set to true [is undoable].
Returns
CreateConnectionInGraphSource(IShape, IShape)
Creates the connection in graph source.
CreateShapeInGraphSource(IShape)
Creates the shape in graph source.
DeleteItems(IEnumerable<IDiagramItem>, bool)
Deletes the items.
Declaration
public void DeleteItems(IEnumerable<IDiagramItem> itemsToDelete, bool isUndoable)
Parameters
itemsToDelete
The items to delete.
isUndoable
If set to true [is undoable].
DeselectItem(IDiagramItem)
Deselects a specific item.
Declaration
public void DeselectItem(IDiagramItem deselectedItem)
Parameters
deselectedItem
Deserialize(SerializationInfo)
Deserializes the specified info.
Declaration
public void Deserialize(SerializationInfo info)
Parameters
info
The info.
Implements
ForceRealization()
Forces the realization.
Declaration
public void ForceRealization()
Group(string, bool, params IGroupable[])
Groups the selected shapes.
Declaration
public IGroup Group(string name = null, bool isUndoable = false, params IGroupable[] items)
Parameters
name
The name.
isUndoable
If set to true the operation [is undoable].
items
The items.
Returns
IsInViewport(IDiagramItem)
Checks if the diagram item is in the viewport.
Declaration
public bool IsInViewport(IDiagramItem item)
Parameters
item
Returns
KeyDown(KeyArgs)
Called when key down event is fired.
KeyUp(KeyArgs)
Called when key up event is fired.
Layout(LayoutType, object)
Organizes the diagram using the specified layout.
Declaration
public void Layout(LayoutType type = LayoutType.Sugiyama, object settings = null)
Parameters
type
The layout type to apply.
settings
The settings specific to the layout type.
Load(string)
Loads the serialized diagram.
Declaration
public void Load(string serializationValue)
Parameters
serializationValue
A string supposedly containing some XML representing a serialized diagram.
MergeItems(IEnumerable<IDiagramItem>, string, bool, Point, Size)
Merges the items in the diagram.
Declaration
[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
The items.
originId
The origin id.
usePosition
If set to true the given position will be used.
position
Point
The position.
size
Size
The size.
Returns
MouseDoubleClick(PointerArgs)
Handles the mouse double click event.
Declaration
public void MouseDoubleClick(PointerArgs e)
Parameters
e
The e.
MouseDown(PointerArgs)
Called when the left mouse button is down.
MouseMove(PointerArgs)
Called when the mouse moves.
MouseUp(PointerArgs)
Called when the mouse left button is up.
Nudge(Point)
Nudges (i.e. a small amount of translation) the selected items with the specified amount.
Declaration
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
public void OnGraphSourceChanged(IGraphSource source)
Parameters
source
The source.
OnItemsChanged(NotifyCollectionChangedEventArgs)
Called when Items collection changes.
Declaration
public void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyCollectionChangedEventArgs
The NotifyCollectionChangedEventArgs instance containing the event data.
OnViewportChanged()
Called when the bounds have changed.
Declaration
public void OnViewportChanged()
Paste(string)
Pastes a diagram, serialized in the clipboard.
Declaration
public IEnumerable<IDiagramItem> Paste(string pasteText)
Parameters
pasteText
Returns
RemoveConnection(IConnection, bool)
Removes the connection.
Declaration
public void RemoveConnection(IConnection connection, bool isUndoable = false)
Parameters
connection
The connection.
isUndoable
If set to true [is undoable].
RemoveShape(IShape, bool)
Removes the shape from the diagram.
Save()
Returns the serialized diagram as an XML-string.
SelectItem(IDiagramItem, bool)
Selects a specific item.
Declaration
public void SelectItem(IDiagramItem selectedItem, bool addToExistingSelection = false)
Parameters
selectedItem
addToExistingSelection
SendBackward(IEnumerable<IDiagramItem>, bool)
Sends selected items backward.
Declaration
public void SendBackward(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters
itemsToSend
isUndoable
SendToBack(IEnumerable<IDiagramItem>, bool)
Sends selected items to back.
Declaration
public void SendToBack(IEnumerable<IDiagramItem> itemsToSend, bool isUndoable = true)
Parameters
itemsToSend
isUndoable
Serialize()
Serializes this instance.
Declaration
public SerializationInfo Serialize()
Returns
Implements
SnapShapes(IEnumerable<IShape>)
Snaps the items based on the snap value. The action is enclosed in a undoable command and supports undo/redo.
Declaration
public void SnapShapes(IEnumerable<IShape> shapes)
Parameters
shapes
Ungroup(bool, params IGroup[])
Ungroups the specified items.