Hello.
I’m using LayeredDigraphLayout model to create tree. Sometimes i need to add a new link to the parent node.
When I add new link, the tree looks good.
If your graph is actually tree-structured, it would be better to use TreeLayout because it has a lot more features that can apply when one assumes the graph forms a tree, and also because it is vastly faster than LayeredDigraphLayout as one scales up to larger graphs.
Certainly when using TreeLayout, it would be beneficial to set go:Part.LayoutId="None" on those blue links. I’m not sure about whether that would help if you continue to use LayeredDigraphLayout.
Either use a data Binding in your Link DataTemplate, or use a separate DataTemplate in your Diagram.LinkTemplateDictionary, in which case you can set the Category on the link data in order to choose the corresponding template.
i’ve tryied to use Diagram.LinkTemplateDictionary, but i can’t understand, how i can set Category, when a add link with myDiagram.Model.AddLink(from, null, to, null)
Can i add link another way?
Oh, I see what you are asking about. Yes, that’s right – you cannot use that overload of the GraphLinksModel.AddLink method. But you can use the other overloaded method: GraphLinksModel.AddLink(LinkType). That way you can create and initialize the link data object in whatever manner you like.
Thank you. It works. But now i use GraphMode and all links added automatically, if i use GraphLinksMode, i have to add links in code. If i understand you correctly.
And I have another question.
if i’m using TreeLayout instead LayeredDigraphLayout links not look such good. Links must look like on the first picture, But now I have:
I found the answer the second question, but the first is actual. I sometimes want to add links like object, but basically i want its created automatically.
GraphModel only has references between node data objects; GraphLinksModel has separate link data objects, so that you can have as many properties as you like and so that you can distinguish between different link relationships.