Dynamic TextBlocks

Hi,
I think there are dynamic ports.So, can we also have dynamic textblocks?
Independent textNode, can you set it to belong to a Node?
Can I dynamically add a TextBlock to a node?

Sure, just include a TextBlock in the itemTemplate. Please read: GoJS Item Arrays-- Northwoods Software

Or if you don’t want to control it dynamically via data, you can do what the Data Flow sample does: Data Flow Diagram

There are two nodes in the diagram.
One node only has shape, no textBlock.I’ll call it A.
The other node only has a textBlock, no shape.I’ll call it B.

I want to know, can B belong to A?
In other words, can B be a part of A?

Can I arbitrarily add B on diagram, and then let it belong to A?
Instead of binding multiple textblocks to Shape in a nodeTemplate.

(By the way, “A” does seem to have a TextBlock, “234”.)

If by “belong to” you mean group membership, then the “A” Node needs to be a Group. This means that:

  • when the user moves “A”, “B” moves along too
  • when the user copies “A”, there is a new copy of “B” that becomes a member of the copied “A”
  • when the user deletes “A”, “B” is deleted too

So yes, if “A” is an instance of a Group, then you can dynamically add or remove other nodes such as “B”.

See for example: