Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Save/load the expanded status of a UltraTree
posted

Hi,

I want to save/load the expanded status of a UltraTree, so firstly I use SaveAsXml to save the UltraTree, but I got an exception saying that:

"Type *** in Assembly *** is not marked as serializable."

The specified type is a custom object in my code, and is set to the Tag of each tree node. But actually I don't want to save the tag, what I need is just serializing the expanded status of each tree node.

How can I solve the problem? Thanks.

 

  • 69832
    Suggested Answer
    Offline posted

    One solution would be to recursively iterate all Nodes collections and clear the Tag property of each node before saving the layout. ANother would be to decorate your custom class with the Serializable attribute, and add a deserialization constructor...you don't necessarily have to bother implementing serialization support for the class, but that should prevent the error.