Persisting Complex Properties

  • Thread starter Thread starter Mark Olbert
  • Start date Start date
M

Mark Olbert

I've written a component that has a few complex properties (i.e., properties with public
subproperties) that need to be persisted.

How do I do this?

I can get "simple" properties (e.g., string) to persist by attributing them with
DesignerSerializationVisiblity(DesignerSerializationVisibility.Visible), but the corresponding
attribute that I >>thought<< would work for complex properties ('Content') doesn't work.

FYI, the complex property is an object with two public string properties, File and Assembly, so they
should be persistable.

I would also like to point out to any Microsofties monitoring this group that the entire issue of
property persistence is stunningly poorly documented, given how important it is if you want to right
anything other than an "idiot" control. Whoever wrote what is available in the online help for
VS.NET ought to be whipped with a wet noodle. Preferably one with barbs.

- Mark
 
Hello Mark,

Create a TypeConverter for your object, and override CanConvertTo and
ConvertTo, do the conversion to an InstanceDescriptor. You can find more
info in articles by Shawn Burke in msdn or at
http://www.windowsforms.net/

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated VS.net graphics editor
 
Thanx. I also found out that implementing ShouldSerialize<myprop> and Reset<myprop> do the trick,
too.

- Mark
 
Back
Top