Create Link to Link


#1

Hello,

We have a need to connect links to links, and we’ve read in the docs that it can be done:"

GraphLinksModel

If you need to support an arbitrary amount of data for each link, or if you need multiple distinct links connecting the same pair of nodes in the same direction, or if you need to connect links to links , you will need to use a separate data structure to represent each link. The GraphLinksModel takes a second data source that is the collection of link data."

but we couldn’t find how to do it

Can you help?

Thanks


#2

I replied to your email a couple days ago with a detailed description of the steps you want to take. Perhaps you didn’t receive that email? If you didn’t, please check whether our mail was classified as spam by your mail system. If that was the case, please whitelist our domain. I can send it again, of course, if you would like.


#3

Actually, there was nothing proprietary in my message. Here it is again:

At the diagram level, it is true that the Link class has FromNode and ToNode properties, but the Link class also has the LabelNode property:
http://www.goxam.com/2.2/helpWPF/webframe.html#Northwoods.GoWPF~Northwoods.GoXam.Link~LabelNode.html

At the model level, GraphLinksModel has LinkFromPath and LinkToPath properties to specify the name of the link data properties to get references to the corresponding nodes, but also the LinkLabelNodePath property:
http://www.goxam.com/2.2/helpWPF/webframe.html#Northwoods.GoWPF~Northwoods.GoXam.Model.GraphLinksModel`4~LinkLabelNodePath.html
And this property specifies how the model is to know that a node data object is supposed to be a link label node:
http://www.goxam.com/2.2/helpWPF/webframe.html#Northwoods.GoWPF~Northwoods.GoXam.Model.GraphLinksModel`4~NodeIsLinkLabelPath.html
These two properties must be set in order for the GraphLinksModel to support label Nodes.

If you are using the generic GraphLinksModelLinkData class, you can just get and set:
http://www.goxam.com/2.2/helpWPF/webframe.html#Northwoods.GoWPF~Northwoods.GoXam.Model.GraphLinksModelLinkData`2~LabelNode.html
Similarly, if using GraphLinksModelNodeData, you can declare a node data object to be a link label node by setting:
http://www.goxam.com/2.2/helpWPF/webframe.html#Northwoods.GoWPF~Northwoods.GoXam.Model.GraphLinksModelNodeData`1~IsLinkLabel.html

As an example, see the Genogram sample. It defines a trivial Node template for link label nodes:

      <DataTemplate x:Key="LinkLabel">
        <Rectangle Width="1" Height="1" go:Part.Selectable="False" />
      </DataTemplate>

But of course you can implement arbitrarily complex node templates acting as link label nodes – I don’t know what you really want to do. For example, if you want users to be able to draw new links to and from link label nodes, you’ll want to make them bigger and enable drawing to and from them, just as you would for regular nodes.

Note how the data is defined in the model. For an example from
Genogram.xaml.cs:

            var rel = FindMarriage(model, key, wife);
            if (rel == null) {
              // add a label node for the marriage link
              var mlab = new Person() { IsLinkLabel = true, Sex = "LinkLabel" };
              model.AddNode(mlab);
              // add the marriage link itself, also referring to the label node
              var mrel = new Relationship() { From = key, To = wife, LabelNode = mlab.Key, Category = "Marriage" };
              model.AddLink(mrel);
            }

#4

Hello Walter,

Thank you for your help.

I have tried following your instructions and achieved partial success.

The problem is: when creating a link between two nodes (from and to) and defining a label node - it works when the route is a straight line, it doesn’t work if the route is defined as ‘orthogonal’

Is there a solution for this?

Thank you
Yaron


#5

What results are you getting?


#6

Hi Walter, please ignore my question I think it is solved