Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

Serializing controls using XML Serialization

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ramesh - 22 Aug 2006 15:08 GMT
I need to serialize forms, controls and user controls using XML
serialization. I am using Xml Overrides to override properties, but this is
very cumbersome and not practical as you know. How do I know if a property
can be serialized using XML serialization or not ?
Any help is appreciated.

Thanks,
Ramesh
Kevin Spencer - 22 Aug 2006 15:56 GMT
First of all, you don't need or want to be serializing Windows Forms
Controls as XML. System.Windows.Forms.Control is not XML Serializable.

Second, you should not need to serialize any interface objects, only data.

As for what is serializable as XML:

public fields
public properties with both a Get and a Set accessor
Classes must have an empty Constructor overload

Note that a class does not have to have all XML-Serializable members to be
serializable. The serializable members will be serialized, and others will
not.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?

>I need to serialize forms, controls and user controls using XML
> serialization. I am using Xml Overrides to override properties, but this
[quoted text clipped - 5 lines]
> Thanks,
> Ramesh
Ramesh - 22 Aug 2006 17:19 GMT
Kevin,
THank you for your quick response. Though Controls are not XML-Serializable,
There is a unique requirement in the application that demands xml
serialization of custom controls derived from System.Windows.Forms.Control.
Interfaces like ISite and properties like Font are not XML-serializable so I
am using XML Overrides not to serialize them. But these overrides are to be
created for each and every control and we need to have an advance knowledge
of what properties fail to be xml-serialized.
So before serializing I want to reflect on the control and inspect
properties that can not be xml-serializable if so to introduce
XmlIgnoreAttribute. This will be done before this class is given to
XmlSerializer. I would like to know if there is a way to identify what can be
xml-serializable and what can not be.(or just exlude all interface-based
properties, read-only properties etc, if so where can i get a comprehensive
list ? ).

Thanks,
Ramesh

> First of all, you don't need or want to be serializing Windows Forms
> Controls as XML. System.Windows.Forms.Control is not XML Serializable.
[quoted text clipped - 20 lines]
> > Thanks,
> > Ramesh
Kevin Spencer - 22 Aug 2006 18:41 GMT
I have no idea.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.

> Kevin,
> THank you for your quick response. Though Controls are not
[quoted text clipped - 51 lines]
>> > Thanks,
>> > Ramesh

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.