CancelEdit and Collections

May 9, 2012 at 12:10 AM

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

May 10, 2012 at 5:09 PM
Edited May 10, 2012 at 5: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 11: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.

May 15, 2012 at 9:17 AM

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