I used the code
*** Custom Router ***
It works properly when two shapes added to a Diagram. Form loads and the two shapes are connected and routing well.
But when I drag two other shapes (items) to the diagram, the routing is ignored! and a straight line is used to connect two shapes.
I expected the public class CustomRouter works like an event and when a shape is dragged, heritage the same properties and behavior.