We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Subclassing TreeNodeAdv and Serialization

I''ve run into a problem that I''m not quite sure how to resolve. I want to subclass the TreeNodeAdv class, but doing so appears to create problems when copying/pasting an instance of the subclass. The TreeNodeAdv class is serializable, and can be retrieved from the clipboard without a problem. Subclasses of the TreeNodeAdv class can be placed on the clipboard easily enough, but can only be retrieved from the clipboard as an instance of a TreeNodeAdv, not as an instance of the subclass. I''m guessing that my subclass would need to implement the constructor and method for the ISerializable interface, but the TreeNodeAdv class doesn''t seem to make this possible, since it already implements ISerializable, and doesn''t expose the constructor or the method of the interface to subclasses. Any idea where to go from here?

3 Replies

AD Administrator Syncfusion Team July 19, 2005 09:58 PM UTC

Hi Mathew, You can still implement ISerializable in your subclass, since C# allows you to reimplement an interface. All TreeNodeAdv saves in GetDataObject is NodeStyle and ChildStyle, which you can do yourself. Regards, Gregory Austin Syncfusion Inc.


MG Mathew Gower July 20, 2005 11:14 AM UTC

> You can still implement ISerializable in your subclass, since C# allows you to reimplement an interface. All TreeNodeAdv saves in GetDataObject is NodeStyle and ChildStyle, which you can do yourself. > Thank you for the reply. Unfortunately, this solution won''t work for us. We''re using VB.NET, which prevents you from re-implementing an interface. We''re working around the problem by associating our data with the tree node, and placing the data on the clipboard. We then reconstruct the tree node when the data is pasted, re-associating the data. Not a perfect solution, but it works. It would be nice if the serializable methods were protected rather than private in future versions to make extended the classes easier in VB.NET.


AD Administrator Syncfusion Team July 22, 2005 03:42 PM UTC

Hi Mathew, I have entered this as Feature Request #291. Regards, Gregory Austin Syncfusion Inc.

Loader.
Up arrow icon