
Signature
___________________________
c-plan® gmbh
Hindenburgstrasse 46
D - 71368 Ludwigburg
Tel.: +49 / (0)7141 / 702 97 - 00
Fax.: +49 / (0)7141 / 702 97 - 80
http://www.c-plan.com
Amtsgericht Vaihingen/Enz HRB 883-M
Geschäftsführer: Frank Markus, Frank von Arx, Toni Fankhauser
Hello Micha,
(1) The existing property displayed as (Name) is an extender property.
(Im not sure that it is really implemened with the help of
the IExtenderProvider interface, but looks and feels so.)
A Component itself has no Name -- the designer supports it in design time.
If you implement a Name property -- it is ANOTHER property. Having two
properties with the same name can cause conflicts. Rename your property
or try using the existing one. (Dont forget: the existing property
is not available at runtime.)
(2) Brousable and DesignerSerializationVisability are two independent
attributes. In a traditional scenario if you set Brosable to false,
then you cannot change the property through the PropertyGrid and there
is no need to serialize the property (since it has the same value).
But if its value is changed in a different way (due to changing other
proprties, for instance, or ... no metter how), then it is quite
reasonable to serialize it. I mean: It is up to you in what combination
you need these two attributes.
(3) You say, there are situations, when the property is serialized.
This means, that the serialization mechanism can handle you property.
(Your case is simple, but with user defined objects, collections,
convertors, etc. it may need some effort when doing this for the 1st time.)
Thus, the designer CAN serialise your property.
(4) Sometimes your prop is not serialized. The reason is, i suppose,
that the designer does not know that it HAS TO. It serializes
ALL properties of a component, if it knows that ANY of them are changed.
(You write
> If I change the Name of the Class it is serailzed........
sounds confirming what i'm writing.)
Try the following: Change another property in PropertyGrid
and look if your property is serialized. Must be there.
The designer cannot see that you assign a new value to a property in you
code and thus it does not know it must serialize ( == refresh
initialization code).
(If you change a property in the PropertyGrid, the grid cares
informing the designer of the change.)
If you change a value in code, you must inform designer explicitely.
There are two ways:
(a) Use PropertDescriptor.OnPropertyChanging and
PropertDescriptor.OnPropertyChanged if you need transaction control,
or better/easier:
(b) Use PropertDescriptor.SetValue()
HTH,
> Hello
>
[quoted text clipped - 19 lines]
>
> Any Idea
Hello Dima
many thanx for your helpfull hints.
I tried different things, but nothing solved this strange Problem.
The Problem occurs only to those Components who have a RootDesigner.
I now found a dirty workaround for the Problem:
If the Name Property is empty I get the Name via "this.GetType.Name"
The only problem with this workaround is that if some of my Users
is using a Obfuscator than the Classname is changed......
Thanx anyway
Micha
hmm, found a better soultion with your Tips in your Mail.
I made a second Property ContainerName (only for those with the
RootDesigner)
where I store the Name too.
I set this Property via my Designer in the Initialize Function
and via the ComponentChangeService you told me.
Then in the Name property i see "ah the Name is empty"
and then I return the "ContainerName" as Name.
Sounds strange why I not totaly Remove the "Name" Property
but I need to have a Property Called "Name"
and can not rename it because otherwise al the existing Code
of my Customers had to be changed an that would worry them.....
Thanx :-)
> Hello Dima
>
[quoted text clipped - 12 lines]
> Thanx anyway
> Micha
Sorry! sorry!
I wrote PropertyDescriptor.OnComponentChanging(),
PropertyDescriptor.OnComponentChanged(). This is wrong.
These both are methods of IComponentChangeService. They need
a PropertyDescriptor as parameter (can be set to null to tell the designer
"i have changed so many properties in this component, that i
dont remember which exectly. You serialize all in any case, so please do").
> Hello
>
[quoted text clipped - 19 lines]
>
> Any Idea