Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic custom control in controlnode (Read 3084 times)
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
custom control in controlnode
Jun 25th, 2009 at 5:49am
Print Post  
Hi,

Please can anyone share the example of hosting silverlite custom control in a control node of a diagram.
Actuall i am trying to create a tree layout with these custom control.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: custom control in controlnode
Reply #1 - Jun 25th, 2009 at 6:12am
Print Post  
Hi,

This example creates a tree of Textbox controls:

Code
Select All
for (int i = 0; i < 10; ++i)
{
	var node = new ControlNode(diagram, new TextBox());
	diagram.Nodes.Add(node);
}

for (int i = 1; i < 10; ++i)
{
	var link = new DiagramLink(diagram,
		diagram.Nodes[i / 3], diagram.Nodes[i]);
	diagram.Links.Add(link);
}

var layout = new TreeLayout();
layout.Arrange(diagram);
 



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


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: custom control in controlnode
Reply #2 - Jun 25th, 2009 at 9:29am
Print Post  
thanks Stoyan !

I changed the code to use my user control.
I am looking at enhancing the diagram by allowing user interraction to drag n drop the controlnodes and changin the hirarchy, creating the links ar runtime n all.
any guidelines around this ?

appreciate your help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: custom control in controlnode
Reply #3 - Jun 25th, 2009 at 10:51am
Print Post  
Hi,

The TreeLayout example shows something similar. There drag-and-drop over a node adds a new ShapeNode as a child in the tree and adds a link to the parent node.

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


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: custom control in controlnode
Reply #4 - Jun 26th, 2009 at 9:15am
Print Post  
Hi,

I have created the diagram with treelayout and user controls as nodes with the drag and drop feature..
bui i am facing issue while relocating the nodes from one parent to other. My dragged item is the usercontrol, but to remove it from its parent i need the corresponding diagram node.

any advice around this will be helpful...
thanks in advance !
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: custom control in controlnode
Reply #5 - Jun 26th, 2009 at 11:50am
Print Post  
Hi,

You might map hosted controls to their nodes using a Dictionary<Control, ControlNode>, or by setting the Control's Tag to the ControlNode that hosts it. If your application won't create huge trees, you might simply loop over all nodes in the diagram and check if their Control property points to the control being dragged.

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


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: custom control in controlnode
Reply #6 - Jun 26th, 2009 at 12:45pm
Print Post  
thanks ! this helps !
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint