CancelEdit and Collections

May 8, 2012 at 11:10 PM

Hi,

I am assuming the default implementation of beginedit and canceledit (silverlight) does not backup/restore collections. What is the best way to handle reference types which would need cloning?

Thanks

Nabil

Coordinator
May 10, 2012 at 4:09 PM
Edited May 10, 2012 at 4:11 PM

You can override the 

  • OnBeginEdit()
  • OnCancelEdit()
  • OnEditEdit()

And do whatever you want to do this those methods, I guess you could use BinaryFormatter to clone whole object using serialization, but you will have to be careful with events using that method


May 12, 2012 at 10:02 AM

Thanks Sacha. I'll try that. Was thinking of using Json.net as the serialiser. Would that be overkill? It seems to always to a good job of dealing with anything I throw at it.

Coordinator
May 15, 2012 at 8:17 AM

I don't know if it will deal with Circular references if you have any. You may want to check that out