New to Telerik UI for WPF? Start a free 30-day trial
Updated on Sep 24, 2025
RadDiagram provides 3 collections that store the DiagramItems - "Items ", "Shapes " and "Connections "
Below you can see a description of the 3 collections:
RadDiagram.Items - inherits from Telerik.Windows.Diagrams.Core.DiagramItemCollection. The DiagramItemCollection inherits from System.Collections.ObjectModel.ObservableCollection. This mean that you are able to add everything in the Items collection. For example, if you add a Button in the Items, the ItemContainerGenerator of the RadDiagram will create a RadDiagramShape which wraps the Button and will add the generated shape in the Shapes collection.
RadDiagram.Shapes - inherits from Telerik.Windows.Diagrams.Core.ShapeCollection. The ShapeCollection inherits from System.Collections.ObjectModel.ReadOnlyCollection <Telerik.Windows.Diagrams.Core.IShape>
RadDiagram.Connections - inherits from Telerik.Windows.Diagrams.Core.ConnectionCollection. The ConnectionCollection inherits from System.Collections.ObjectModel.ReadOnlyCollection <Telerik.Windows.Diagrams.Core.IConnection>
Here you can see a possible way to iterate the Shapes or Connection of the RadDiagram:
C# VB.NET
this . diagram. Shapes. ToList ( ) . ForEach ( x =>
{
( x as RadDiagramShape ) . Content = "Shape" ;
} ) ; Me .diagram.Shapes.ToList( ) .ForEach( Function ( x)
TryCast ( x, RadDiagramShape) .Content = "Shape"
End Function )
The RadDiagram exposes two extension methods which you can use to iterate through the incoming and outgoing connections of a shape:
public static IEnumerable GetOutgoingConnectionsForShape(this IGraph graph, IShape shape)
public static IEnumerable GetIncomingConnectionsForShape(this IGraph graph, IShape shape)
In order to take advatnage of these methods you need to add a using statement for the Telerik.Windows.Diagrams.Core namespace in your code-behind file. Then you'll be able to access both methods through a RadDiagram instance:
C# VB.NET
using Telerik. Windows. Diagrams. Core ;
.. .
xDiagram. GetOutgoingConnectionsForShape ( shape) ;
xDiagram. GetIncomingConnectionsForShape ( shape) ; Imports Telerik.Windows.Diagrams.Core
...
xDiagram.GetOutgoingConnectionsForShape( shape)
xDiagram.GetIncomingConnectionsForShape( shape)