How to create a custom connection class?

3 posts, 0 answers
  1. Ruslan
    Ruslan avatar
    15 posts
    Member since:
    Jul 2011

    Posted 16 Apr 2012 Link to this post

    I need to replace the RadDiagramConnection to the inherits class of RadDiagramConnection.
  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 18 Apr 2012 Link to this post

    Hello Ruslan,

     We are not sure we understand you correctly. Could you please elaborate more on your desired scenario ? Why do you need to inherit the RadDiagramConnection ? What do you need to customize exactly ?

    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Hans
    Hans avatar
    15 posts
    Member since:
    Jan 2011

    Posted 14 Mar 2014 in reply to Ruslan Link to this post


    Perhaps I can ellaborate on why one would override the RadDiagramConnection. I noticed that there is no information explaining how to do this, neither in the Telerik documentation or in the forums.

    First of all, my reason for overriding the RadDiagramConnection is because I need additional properties on the connection. We have developed a way to execute diagrams containing business logic, and the connection needs properties as IsPaused and IsCanceled to indicate if the diagram can continue to the next shape or not.

    If you wish to use a different connection class, you must also inherit from the RadDiagram. The RadDiagram contains a number of methods that will allow you to provide your custom connection class when the diagram mechanism requires a connection:

    public abstract class ExecutableDiagramBase : RadDiagram, IExecutableDiagram
        #region Constructors & Destructors
        protected ExecutableDiagramBase()
        #region Connection Management
        protected override IConnection GetConnectionContainerForItemOverride(object item)
            return new ExecutableConnection();
        protected override void PrepareConnectionContainerForItemOverride(FrameworkElement container, object item)
            base.PrepareConnectionContainerForItemOverride(container, item);
        protected override bool IsItemItsOwnConnectionContainerOverride(object item)
            return base.IsItemItsOwnConnectionContainerOverride(item);

    Please note that the ExecutableConnection class is a custom connection class, inheriting from RadDiagramConnection.

    I hope this helps someone.

    Kind regards,
Back to Top