Hi Mel,
You could try using grouping:
void TestGroups()
{
var container = diagram.Factory.CreateShapeNode(
10, 10, 200, 200, Shapes.Rectangle);
container.AllowIncomingLinks = false;
container.AllowOutgoingLinks = false;
var outChild = diagram.Factory.CreateShapeNode(
container.Bounds.Right - 20,
container.Bounds.Top + 20,
20, 50, Shapes.Rectangle);
outChild.AllowIncomingLinks = false;
outChild.AllowOutgoingLinks = true;
outChild.AttachTo(container,
GroupAnchorStyles.Top | GroupAnchorStyles.Right);
outChild.EnabledHandles = AdjustmentHandles.None;
var inChild = diagram.Factory.CreateShapeNode(
container.Bounds.Left,
container.Bounds.Top + 20,
20, 50, Shapes.Rectangle);
inChild.AllowIncomingLinks = true;
inChild.AllowOutgoingLinks = false;
inChild.AttachTo(container,
GroupAnchorStyles.Top | GroupAnchorStyles.Left);
inChild.EnabledHandles = AdjustmentHandles.None;
}
with a possible drawback you will have to look for the links inside main node's SubordinateGroup -> AttachedNodes -> *Links collections, and get link's node through link.*Node.MasterGroup.MainItem.
Other methods you could try:
- custom-draw the rectangles inside a single ShapeNode; handle link validation events to prevent drawing links from outside the rectangles.
- use several anchor points for each linkable rectangle, with MarkStyle set to Custom; draw a single rectangle for the group of points.
Regards,
Slavcho
Mindfusion