Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Dragdrop Shape on ShapeNode (Read 2110 times)
Thunis
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Sep 3rd, 2014
Dragdrop Shape on ShapeNode
May 18th, 2015 at 7:05pm
Print Post  
Hi Support,

How would I go around to only replace the Shape for a ShapeNode if I drag and drop another ShapeNode from the NodeListView onto the ShapeNode on the diagram? I don't want to create another node with the drag drop action only replace the Shapes for the Nodes.

Regards,
Thunis
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Dragdrop Shape on ShapeNode
Reply #1 - May 19th, 2015 at 7:13am
Print Post  
Hi,

Handle the Diagram.PreviewDrop event like this:

Code
Select All
if (e.Data.GetDataPresent(typeof(DraggedNode)))
{
	var data = (DraggedNode)e.Data.GetData(typeof(DraggedNode));
	var position = e.GetPosition(diagram.DocumentPlane);
	var shapeNode1 = diagram.GetNodeAt(position) as ShapeNode;
	var shapeNode2 = data.Node as ShapeNode;
	if (shapeNode1 != null && shapeNode2 != null)
	{
		shapeNode1.Shape = shapeNode2.Shape;
		e.Effects = DragDropEffects.Copy;
		e.Handled = true;
	}
} 



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


I Love MindFusion!

Posts: 3
Joined: Sep 3rd, 2014
Re: Dragdrop Shape on ShapeNode
Reply #2 - May 19th, 2015 at 11:23am
Print Post  
Thanks - Work 100% Cheesy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint