Persisting complex custom properties between postbacks

I am trying to build an image slideshow as a custom property. Every slide consists of an image, a text (xhtml) and a boolean (visible yes/no). The slideshow can have any number of slides and the user should be able to reorder the slides.

Now I have created the slideshow-property based on the explanation from http://joelabrahamsson.com/entry/creating-a-custom-episerver-property-with-a-custom-class-as-value. I replaced the Keyword-class with a custom class consisting of three EPiServer-properties: PropertyImageUrl, PropertyXhtmlString and PropertyBoolean.
This does work and the editor shows up correctly in CMS.

The problem however is that the property is not persisted between postbacks. Because I have add-, delete- and order-buttons in the control, postbacks are made. For example: when I click 'Add slide', an Slide-item is added to the collection in code. A new editor for the slide appears on screen, but when I try to add another slide, the previous one is lost.
So, whenever a postback occurs, the property is reloaded and my control is reset to the original state. Any changes made, are lost.

How can I make sure the property is stored between the postbacks? Of course I can think of ways of keeping track of the changes, but I would like to be able to use the property itself so I can easily reorder the items.

#59208 May 24, 2012 12:35