This is a migrated thread and some comments may be shown as answers.

How to register my custom IRoutingService

3 Answers 84 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
donovan
Top achievements
Rank 1
donovan asked on 11 Jun 2012, 10:10 PM
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

3 Answers, 1 is accepted

Sort by
0
donovan
Top achievements
Rank 1
answered on 11 Jun 2012, 11:55 PM
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
0
Petar Mladenov
Telerik team
answered on 12 Jun 2012, 01:40 PM
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 >>

0
donovan
Top achievements
Rank 1
answered on 12 Jun 2012, 01:41 PM
Thank you.
Tags
Diagram
Asked by
donovan
Top achievements
Rank 1
Answers by
donovan
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or