Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Ctrl-C For Custom Nodes (Read 1715 times)
sydneyos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Ctrl-C For Custom Nodes
Apr 3rd, 2009 at 12:23am
Print Post  
Just to revive a question that was raised in this link: http://mindfusion.eu/Forum/YaBB.pl?board=wpfdg_disc;action=display;num=123850285...:

Stoyan Said:   Copy to clipboard won't work if you are using a custom node type that does not override the Clone method nor implements a copy constructor. The control automatically binds the ApplicationCommands.Copy command to the Diagram.CopyToClipboard() method. You could replace it with your own binding if you want to stop Ctrl+C.

I said: Can you say more? What would be the steps/code to replace the binding? What does a Copy constructor look like?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Ctrl-C For Custom Nodes
Reply #1 - Apr 3rd, 2009 at 8:10am
Print Post  
Replacing the binding looks like this:

Code
Select All
diagram.CommandBindings.Add(
	new CommandBinding(ApplicationCommands.Copy, (sender, args) => { }));
 



A copy constructor is a constructor that takes as an argument an instance of the same type:
Code
Select All
public MyNode(MyNode prototype) : base(prototype)
{
	MyProperty = prototype.MyProperty;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint