Hide property at designtime

  • Thread starter Thread starter greg.bacchus
  • Start date Start date
G

greg.bacchus

Hi,
If I make a control, I want to be able to make it so that various
properties are not initialised by the designer.

I realise that if you put [Browsable(false)] that it won't show up in
the properties window... but for some reason the auto-generated code
insists on initialising it anyway. This is really irritating. Does
anyone know how to stop this?

Cheers
Greg
 
Hi,
If I make a control, I want to be able to make it so that various
properties are not initialised by the designer.

I realise that if you put [Browsable(false)] that it won't show up in
the properties window... but for some reason the auto-generated code
insists on initialising it anyway. This is really irritating. Does
anyone know how to stop this?

It's my understanding that every property (public) is initialized, you
can't do a thing about it. The only thing you can do is to do all the
'serialization' at design time for your control, but you don't want that
I think, as you then have to generate ALL code for your control.

Why do you want to have some properties not to be initialized? If it's
the code vs.net generates which deserializes objects from a resource
file, you can fix that by defining a type converter class for that type
which checks if the destination type is an InstanceDescriptor, and if so
you should create one in your own typeconverter.

Frans

--
 
Thanks,
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
seemed to do it :)

Greg
 
Back
Top