Hi Meelis,
A property can have only one type, but if you declare it as Object, it can
hold values of different types (Windows.Forms.CheckState or Boolean, as in
your case). However, a class with an Object type property in a PropertyGrid
(used by the properties window) won´t show the enum values for the type,
since the type is Object and the PropertyGrid looks at the property type,
not at the type of the actual value (which could be Nothing). So, for the
PropertyGrid to work as you expect, you need two properties, one Boolean and
other Windows.Forms.CheckState and the design-time architecture is powerful
enough (at least .NET 2.0) to dinamically allow hiding one or the other
property to the PropertyGrid depending on the value of a 3rd property. You
can do this adding or removing the Browsable attribute to the property of
component instance, not to the property of the type (it could affect other
instances).
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
"Meelis" <me*@hot.ee> escribió en el mensaje
news:Ob**************@TK2MSFTNGP14.phx.gbl...
Hi Chris
Yes, in .NET you can have same names for property and value, but thats not
the probelm.
I'll try to explain what i want in my poor english
Lets say i have two properties p1 and p2
p1 is integer and value can be 1 or 2
if value is 1 then p2 type must be Windows.Forms.CheckState
and if value is2 then p2 type must me Boolean
now step by step
If user selects in property window p1 value to 1,
p2 type mus change to CheckState and user can select Checked, UnChecked
aso.
If p1 value is selected to be 2
p2 type must be Boolean and use can select True or False.
Hope you understand me :)
Meelis