New to Telerik UI for WPF? Download free 30-day trial

GraphSourceBase

Telerik Diagramming Framework provides a list of ViewModels defined in the Telerik.Windows.Controls.Diagrams.Extensions.dll.

This article describes the GraphSourceBase class defined in the Diagramming Extensions.

Overview

The GraphSourceBase class is designed to serve as a base ViewModel that represents the collections of nodes and shapes in a data-bound RadDiagram. In a RadDiagram you always need to consider the fact that it consists of different types of items - RadDiagramConnections and RadDiagramShapes. This is why the RadDiagram GraphSource should be set to an instance of a class that implements theIGraphSource interface. This interface defines two collections - one with Items and one with Links.

The GraphSourceBase class implements the IGraphSource interface and it also provides methods that work with the Items and Links collections.

Please keep in mind that in the GraphSourceBase implementation, TLink should derive from the ILink interface.

GraphSourceBase Inheritance Model raddiagram-data-graphsource

GraphSourceBase has one constructor - GraphSourceBase() that initializes a new instance of the class.

Properties

GraphSourceBase exposes the following properties:

Name Description
InternalItems Gets the internal ObservableCollection of business nodes.
InternalLinks Gets the internal ObservableCollection of business links.
Items Gets an IEnumerable collection of business nodes.
Links Gets an IEnumerable collection of business links.

Methods

GraphSourceBase exposes the following virtual methods:

Name Description
AddNode(TNode) Adds a specified business node to the InternalItems collection.
AddLink(TLink) Adds a specified business link to the InternalLinks collection.
RemoveLink(TLink) Removes a specified business link from the InternalLinks collection and returns a boolean value indicating whether the operation was successful.
RemoveItem(TNode) Removes a specified business node from the InternalItems collection and returns a boolean value indicating whether the operation was successful.
Clear Removes all nodes and links from the InternalItems and InternalLinks collections.

Please note that in your solution it is best to create a custom class deriving from GraphSourceBase. Once you do so, you will be able to override all of the above virtual methods and describe a custom RadDiagram GraphSource implementation.

See Also

In this article