We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Copy/Paste text node but with more information

Hi,

I need to control copy/paste of a selected text node. In my case I have to copy not only the "design" but the information, xml information that I have associated to a node.

When I copy a selected node I need to know which node is to duplicate not only the node but the information in my xml archive. I need the name of the node selected during copy/paste but I don't know how to make it, could you help me?

Thanks

1 Reply

NG Naganathan Ganesh Babu Syncfusion Team February 23, 2016 12:49 PM UTC

Hi Blanca,
 
Thanks for contacting Syncfusion support.
 

I need to control copy/paste of a selected text node. In my case I have to copy not only the "design" but the information, xml information that I have associated to a node.

In order to achieve your requirement, please override the “Clone” method in customized class and customized class must be in serialized format. Otherwise, you can use Node’s “PropertyBag” property to add the custom properties for the default nodes. Please refer to the below code example and sample.


Code example:


[C#]


//constructor with SerializationInfo and StreamingContext

protected CustomRectangle(SerializationInfo info, StreamingContext context)

: base(info, context)

{

}


//Clone the Custome symbol

public override object Clone()

{

return new CustomRectangle(this);

}


Sample:


Sample



When I copy a selected node I need to know which node is to duplicate not only the node but the information in my xml archive. I need the name of the node selected during copy/paste but I don't know how to make it, could you help me?

By default you can copy/paste the selected nodes only. So you can use Diagram’s “KeyUp” events to get the selected nodes while copying/pasting the nodes. Please refer to the below code example.


Code example:


[C#]


diagram1.KeyUp += new KeyEventHandler(diagram1_KeyUp);


void diagram1_KeyUp(object sender, KeyEventArgs e)

{

if (e.Control && e.KeyCode == Keys.C)

{

//copy nodes

NodeCollection copy = diagram1.View.SelectionList;

}

if (e.Control && e.KeyCode == Keys.V)

{

//pasted nodes

NodeCollection paste = diagram1.View.SelectionList;

}

}



 
Sample:
 
Sample
 
Regards,
 
Naganathan K G

Loader.
Live Chat Icon For mobile
Up arrow icon