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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copy/Paste text node but with more information

Thread ID:

Created:

Updated:

Platform:

Replies:

123160 Feb 22,2016 11:30 AM UTC Feb 23,2016 12:49 PM UTC WinForms 1
loading
Tags: Diagram
Blanca Calderon
Asked On February 22, 2016 11:30 AM UTC

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

Naganathan Ganesh Babu [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;