Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drag/Drop from Infragistics Ultragrid? (Read 5529 times)
Neverforget115
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Feb 11th, 2013
Drag/Drop from Infragistics Ultragrid?
Feb 11th, 2013 at 2:36pm
Print Post  
Hello all,

I am new to these forums, so I hope that this is the correct location for this post. 

I have a Mindfusion.Diagramming.DiagramView control which I load with a new diagram upon loading a form.  In the same tab which this DiagramView resides, I also have three Infragistics Ultragrids.  Each row in each ultragrid has an underlying data object that contains several properties that I would like to create nodes from in the diagram. 

For what it's worth, I currently have drag-and-drop functionality for the nodes that are contained in the diagram, so that they can only move to authorized locations, and I also have functionality that allows me to drag and drop  list objects between the ultragrids.  I just don't have any idea how to get the list object from the ultragrid into the mindfusion diagram and create a node with text and tag properties set from the list object.

Any advice would be appreciated.

Thank you!
-Seth
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Drag/Drop from Infragistics Ultragrid?
Reply #1 - Feb 11th, 2013 at 2:58pm
Print Post  
Hi,

To create nodes for the data dragged from an external control, set the DiagramView.AllowDrop property and create nodes from the DragDrop event handler. For example, this lets you create nodes showing the text dragged from a TextBox (or an external drag-and-drop enabled application):

Code
Select All
private void Form1_Load(object sender, System.EventArgs e)
{
	diagramView.AllowDrop = true;
}

private void diagramView_DragOver(object sender, DragEventArgs e)
{
	e.Effect = DragDropEffects.Copy;
}

SizeF nodeSize = new SizeF(40, 30);

private void diagramView_DragDrop(object sender, DragEventArgs e)
{
	var point = diagramView.ClientToDoc(
		diagramView.PointToClient(new Point(e.X, e.Y)));

	var node = diagram.Factory.CreateShapeNode(
		point.X - nodeSize.Width / 2,
		point.Y - nodeSize.Height / 2,
		nodeSize.Width, nodeSize.Height);
	node.Text = (string)e.Data.GetData(typeof(string));

	e.Effect = DragDropEffects.Copy;
} 



If you have implemented code for dragging rows between the grids, you probably already know how to extract the row data from a DragEventArgs instance.

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


I Love MindFusion!

Posts: 4
Joined: Feb 11th, 2013
Re: Drag/Drop from Infragistics Ultragrid?
Reply #2 - Feb 11th, 2013 at 5:30pm
Print Post  
Hello Stoyan,

Thank you very much for your response!  It worked just as you described.

Have a good day!
-Seth
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint