Creating elbows on paths

We’ve been doing some searching on a way to do the following

1) Draw a straight link between 2 nodes
2) click on the link
3) divide the link dynamically into two segments and a segment adornment
4) be able to drag adornment to adjust dual segment
5) click on a segment again and repeat process.
Do you have any guidance on how this can be done?

Yes, we have such code working in WPF, but it hasn’t been ported to Silverlight. Are you using WPF or Silverlight? Are you using version 1.2? Silverlight 4?

we are actually using both Silverlight and WPF and linking projects (so sharing code between projects). I’m curious to see the solution for WPF and maybe a creative solution for Silverlight :-). One thing we thought of doing for Silverlight is just creating an additional node between nodes and adding straight links, but managing this would be tricky. (e.g. what if you select a segment, you would have to select all of the segments). We are using 1.2 by the way and Silverlight 4.0

best,
-Mike
<>

<w:LatentStyles DefLockedState=“false” DefUnhideWhenUsed=“true”
DefSemi=“true” DefQat=“false” DefPriority=“99”
LatentStyleCount=“267”>
<w:LsdException Locked=“false” Priority=“0” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Normal”/>
<w:LsdException Locked=“false” Priority=“9” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“ing 1”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 2”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 3”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 4”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 5”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 6”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 7”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 8”/>
<w:LsdException Locked=“false” Priority=“9” Qat=“true” Name=“ing 9”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 1”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 2”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 3”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 4”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 5”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 6”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 7”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 8”/>
<w:LsdException Locked=“false” Priority=“39” Name=“toc 9”/>
<w:LsdException Locked=“false” Priority=“35” Qat=“true” Name=“caption”/>
<w:LsdException Locked=“false” Priority=“10” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Title”/>
<w:LsdException Locked=“false” Priority=“1” Name=“Default Paragraph Font”/>
<w:LsdException Locked=“false” Priority=“11” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Subtitle”/>
<w:LsdException Locked=“false” Priority=“22” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Strong”/>
<w:LsdException Locked=“false” Priority=“20” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Emphasis”/>
<w:LsdException Locked=“false” Priority=“59” Semi=“false”
UnhideWhenUsed=“false” Name=“Table Grid”/>
<w:LsdException Locked=“false” UnhideWhenUsed=“false” Name=“Placeholder Text”/>
<w:LsdException Locked=“false” Priority=“1” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“No Spacing”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 1”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 1”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 1”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 1”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 1”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 1”/>
<w:LsdException Locked=“false” UnhideWhenUsed=“false” Name=“Revision”/>
<w:LsdException Locked=“false” Priority=“34” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“List Paragraph”/>
<w:LsdException Locked=“false” Priority=“29” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Quote”/>
<w:LsdException Locked=“false” Priority=“30” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Intense Quote”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 1”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 1”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 1”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 1”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 1”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 1”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 1”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 1”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 2”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 2”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 2”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 2”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 2”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 2”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 2”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 2”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 2”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 2”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 2”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 2”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 2”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 2”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 3”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 3”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 3”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 3”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 3”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 3”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 3”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 3”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 3”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 3”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 3”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 3”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 3”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 3”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 4”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 4”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 4”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 4”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 4”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 4”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 4”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 4”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 4”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 4”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 4”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 4”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 4”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 4”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 5”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 5”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 5”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 5”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 5”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 5”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 5”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 5”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 5”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 5”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 5”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 5”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 5”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 5”/>
<w:LsdException Locked=“false” Priority=“60” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Shading Accent 6”/>
<w:LsdException Locked=“false” Priority=“61” Semi=“false”
UnhideWhenUsed=“false” Name=“Light List Accent 6”/>
<w:LsdException Locked=“false” Priority=“62” Semi=“false”
UnhideWhenUsed=“false” Name=“Light Grid Accent 6”/>
<w:LsdException Locked=“false” Priority=“63” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 1 Accent 6”/>
<w:LsdException Locked=“false” Priority=“64” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Shading 2 Accent 6”/>
<w:LsdException Locked=“false” Priority=“65” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 1 Accent 6”/>
<w:LsdException Locked=“false” Priority=“66” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium List 2 Accent 6”/>
<w:LsdException Locked=“false” Priority=“67” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 1 Accent 6”/>
<w:LsdException Locked=“false” Priority=“68” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 2 Accent 6”/>
<w:LsdException Locked=“false” Priority=“69” Semi=“false”
UnhideWhenUsed=“false” Name=“Medium Grid 3 Accent 6”/>
<w:LsdException Locked=“false” Priority=“70” Semi=“false”
UnhideWhenUsed=“false” Name=“Dark List Accent 6”/>
<w:LsdException Locked=“false” Priority=“71” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Shading Accent 6”/>
<w:LsdException Locked=“false” Priority=“72” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful List Accent 6”/>
<w:LsdException Locked=“false” Priority=“73” Semi=“false”
UnhideWhenUsed=“false” Name=“Colorful Grid Accent 6”/>
<w:LsdException Locked=“false” Priority=“19” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Subtle Emphasis”/>
<w:LsdException Locked=“false” Priority=“21” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Intense Emphasis”/>
<w:LsdException Locked=“false” Priority=“31” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Subtle Reference”/>
<w:LsdException Locked=“false” Priority=“32” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Intense Reference”/>
<w:LsdException Locked=“false” Priority=“33” Semi=“false”
UnhideWhenUsed=“false” Qat=“true” Name=“Book Title”/>
<w:LsdException Locked=“false” Priority=“37” Name=“Bibliography”/>
<w:LsdException Locked=“false” Priority=“39” Qat=“true” Name=“TOC ing”/>
</w:LatentStyles>
</><![endif]–><!–[if gte mso 10]>
<>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:“Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:“Calibri”,“sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:“Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;
mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Here’s how you could define a custom tool for reshaping links.

This is for WPF. I haven’t tried it in Silverlight 4.

public class CustomLinkReshapingTool : LinkReshapingTool { private const String ToolCategory = "Reshape Link"; public override void UpdateAdornments(Part part) { Link link = part as Link; if (link == null) return; // no Nodes

Adornment adornment = null; if (link.IsSelected) { FrameworkElement selelt = link.Path; Route route = link.Route; if (selelt != null && route != null && link.CanReshape() && Part.IsVisibleElement(selelt)) {

adornment = link.GetAdornment(ToolCategory);

if (adornment == null)
{

IEnumerable<Point>
pts = route.Points;

int numpts = route.PointsCount;

if (numpts < 2) return;

// this Adornment consists of a LinkPanel holding a bunch of ToolHandles

LinkPanel panel = new
LinkPanel();

int firstindex = 0;

int lastindex = numpts-1;

for (int i =
firstindex; i <= lastindex; i++) {

// the handle at each vertex point:

FrameworkElement h = new ToolHandle() {

Width=6,

Height=6,

Fill=Brushes.Yellow,

Stroke=Brushes.Black,

StrokeThickness=1

};

NodePanel.SetFigure(h, NodeFigure.Rectangle);

// identify the segment for this particular handle

LinkPanel.SetIndex(h, i);

// allow reshape behavior if not at either end

if (i == firstindex || i == lastindex) {

// default ReshapeBehavior.None

} else {

SetReshapeBehavior(h, ReshapeBehavior.All);

h.Cursor = Cursors.Hand;

}

panel.Children.Add(h);

// now the handle at the middle of each segment:

if (i < lastindex) { // but no middle handle after the last vertex!

// the handle at the middle of each segment:

h = new ToolHandle()
{

Width=6,

Height=6,

Fill=Brushes.Yellow,

Stroke=Brushes.Black,

StrokeThickness=1

};

NodePanel.SetFigure(h, NodeFigure.Ellipse);

// identify this particular handle within the
LinkPanel

LinkPanel.SetIndex(h, i); // the segment

LinkPanel.SetFraction(h, 0.5); // how far along the segment

SetReshapeBehavior(h, ReshapeBehavior.All);

h.Cursor = Cursors.Hand;

panel.Children.Add(h);

      }

}

adornment = new Adornment();

adornment.AdornedElement = selelt;

adornment.Category = ToolCategory;

adornment.Content = panel; // just provide the
FrameworkElement as the Content and as the Visual Child

adornment.LocationSpot = Spot.TopLeft;

}
}
if (adornment != null)
{

Point loc = link.GetElementPoint(selelt, Spot.TopLeft);

adornment.Position = loc;

adornment.Remeasure();
}
}
link.SetAdornment(ToolCategory,
adornment);
}

protected override void DoReshape(Point newPoint) { Link link = this.AdornedLink; Route route = link.Route; ReshapeBehavior behavior = GetReshapeBehavior(this.Handle); if (behavior != ReshapeBehavior.None) { int idx = this.HandleIndex; double frac = LinkPanel.GetFraction(this.Handle); if (frac == 0) { // dragging a vertex point reshape handle

route.SetPoint(idx, newPoint);
} else { // dragging a
mid-segment reshape handle

idx++; // insert new point after the
current index

route.InsertPoint(idx, newPoint);

this.InsertionIndex = idx;

// force the reshape handles to be re-created

link.SetAdornment(ToolCategory, null);

UpdateAdornments(link);

// find the new vertex point reshape handle

Adornment ad =
link.GetAdornment(ToolCategory);

if (ad == null)
return;

LinkPanel lp = ad.FindDescendant(e => e is LinkPanel) as LinkPanel;

if (lp == null)
return;

this.Handle = lp.Children.OfType<ToolHandle>().FirstOrDefault(h => LinkPanel.GetIndex(h) == idx && LinkPanel.GetFraction(h) == 0);

this.HandleIndex = idx;

// now continue reshaping with the new vertex point
handle

}
}
}

private int InsertionIndex { get; set; }

public override void DoStart() { base.DoStart(); this.InsertionIndex = 0; }

public override void DoCancel() { if (this.InsertionIndex > 0) { this.AdornedLink.Route.RemovePoint(this.InsertionIndex); // force the reshape handles to be re-created this.AdornedLink.SetAdornment(ToolCategory, null);

UpdateAdornments(this.AdornedLink);

StopTool();
} else {
base.DoCancel();
}
}
}

To register the tool, just set your Diagram’s LinkReshapingTool property to an instance of this new tool class.

For example:

myDiagram.LinkReshapingTool = new CustomLinkReshapingTool();

Or you could do it in XAML:

<go:Diagram . . . > <go:Diagram.LinkReshapingTool> <local:CustomLinkReshapingTool /> </go:Diagram.LinkReshapingTool> </go:Diagram>

Caution: I haven't tried this code in a year or so.