Nevron Forum

Draging diagram nodes without implementing ICLoneable

https://www.nevron.com/Forum/Topic3438.aspx

By yoav Roytenberg - Wednesday, April 28, 2010

I have a diagram which binds to my custom data, by setting the "Tag" attribute of each of the shapes in the diagram.
When I try to move one of the shapes in the diagram, by dragging, I get a message "In order to deeply copiable non primitive types must implement ICLoneable"
Is there a way to prevent this message from showing? I don't want to change my data source to inherit ICloneable etc.
By Nevron Support - Wednesday, April 28, 2010

Hi,

ICloneable must be implemented for the type you assign to the Tag property of the shapes.

By Nevron Support - Thursday, April 29, 2010

Hi,

After rereading your post I think that we need to clarify a little. If you are assigning a data source as a Tag value, this does not mean that you need to clone the data source, but rather create a surrogate object that is ICloneable and performs shallow cloning of its members. For example:

[Serializable]
public class MyTag : ICloneable
{
public MyTag()
{
}
public object Clone()
{
MyTag clone = MyTag();
clone.DataSource = DataSource;
return clone;
}
public object DataSource;
}