Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Complex node (Read 4428 times)
RichardW2C
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jul 13th, 2011
Complex node
Jul 13th, 2011 at 4:02pm
Print Post  
Hi

I am new both to WPF and MindFusion tools, so probably it is ambitious project for me. What I would like to do is a node with 2 parts, a part that is a panel with various controls, and a second part, below, who is a grid or a datagrid. What I would like is to give the user the ability to link some items (lines) in the datagrid to others items (lines) in another node of the same type.


Thanks for any help Smiley

Richard


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Complex node
Reply #1 - Jul 13th, 2011 at 4:33pm
Print Post  
Hi!

The easiest way to implement this is to really use two types of nodes.

The panel part could be a UserControl wrapped in a DiagramNodeAdapter. You get an adapter created automatically if you simply call diagram.Nodes.Add(userControlInstance), or you could explicitly create one to access its properties. For another way to create the panel, see tutorial 3.

For the grid part use a TableNode with as many rows and columns you need. Set its CaptionHeight to 0 to hide the table's caption area.

Next, use the AttachTo method to glue one of the nodes to the other one, or perhaps create a background node that will fit the two parts inside it.

An alternative (and harder to implement) option is to create a custom node type that shows the grid as part of its Xaml template. You will also have to derive from the ConnectionPoint class to keep information about the grid line where the link connects, and return instance of this class from your nodes' CreateConnectionPoint override.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
RichardW2C
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jul 13th, 2011
Re: Complex node
Reply #2 - Jul 18th, 2011 at 7:54am
Print Post  
Hi Stoyan!

Thanks for your answer, it helps, I'll try that!

  
Back to top
 
IP Logged
 
RichardW2C
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jul 13th, 2011
Re: Complex node
Reply #3 - Jul 21st, 2011 at 12:44pm
Print Post  
Please, for an attached node, is there a way to glue the 2 nodes? When I move the master node, the other move, but when I move the second node, the master one will not move.


Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Complex node
Reply #4 - Jul 21st, 2011 at 4:34pm
Print Post  
I think you can attach them in circular manner, node1.AttachTo(node2) and node2.AttachTo(node1).

If that does not work, try using a background transparent node as container and attach both nodes to it. Then you can handle NodeSelected to deselect the child nodes if the user clicks them and select the container instead.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
RichardW2C
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jul 13th, 2011
Re: Complex node
Reply #5 - Jul 25th, 2011 at 12:30pm
Print Post  
Hi

If I attach A to B and B to A, I get an overflow. Small wonder Wink .

For the second suggestion, I am not sure I understand.

If you mean that I should create a third node and attach the A and B to it, but how that will prevent the user to move A or B?

If you mean that I should create a third node and this node has it own collection of "children nodes", please could you show me how to do that, with a few lines of code?

In fact, a few lines of example would be great anyway Smiley .

Thanks a lot
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Complex node
Reply #6 - Jul 25th, 2011 at 1:48pm
Print Post  
Try this sample:

https://mindfusion.eu/_samples/_sample_GluedNodes.zip

It implements the above suggestion to 'glue' both nodes to an invisible parent. An attempt to select any of the child nodes will select the parent node and the subsequent move will move both nodes simultaneously.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
RichardW2C
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jul 13th, 2011
Re: Complex node
Reply #7 - Jul 25th, 2011 at 2:51pm
Print Post  
It works fine, thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint