How to register my custom IRoutingService

4 posts, 0 answers
  1. donovan
    donovan avatar
    13 posts
    Member since:
    Oct 2011

    Posted 11 Jun 2012 Link to this post

    Looking through the code of the 2012 Q2 release it appears if I can register my own IRoutingService I would be able to control the lines drawn for my connections. 

    First is that true statement?  And if so is there a sample on how to do that?

    Thanks
    Donovan
  2. donovan
    donovan avatar
    13 posts
    Member since:
    Oct 2011

    Posted 11 Jun 2012 Link to this post

    After further investigation I decided to derive my own class from RadDiagram.  I then overrode the OnInitialized method and inside set the IRouter property of the RoutingService to my custom Router.

    Seems to be doing the trick, however, if there is a better implementation please let me know.

    Donovan
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 12 Jun 2012 Link to this post

    Hi Donovan,

     Thank you for your interest in this feature. it will be documented till the end of this week.
    However, there is no need to inherit the whole diagram. You can create your custom Router by implementing the IRouter Interface:

    public class MyCustomRouter : IRouter
        {
            public System.Collections.Generic.IList<Point> GetRoutePoints(IConnection connection, bool showLastLine)
            {
                return new List<Point>(){new Point(0,100), new Point(100, 200)};
            }
        }
    public MainPage()
            {
                InitializeComponent();
                this.diagram.RoutingService.Router = new MyCustomRouter();
            }
    Please let us know if this is suitable for you.

    All the best,
    Petar Mladenov
    the Telerik team

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

  5. donovan
    donovan avatar
    13 posts
    Member since:
    Oct 2011

    Posted 12 Jun 2012 Link to this post

    Thank you.
Back to Top