Hi Ron,
You can create a TypeConverter for your class and override the GetProperties
and GetPropertiesSupported methods. You can add, remove or change the
properties being displayed for any Component that is defined with your
TypConverter via a TypeConverterAttribute. TypeConverterAttribute can also be
declared on properties in your class to control their behavior in the
PropertyGrid as well.
In the GetProperties method, you can use methods from the
System.ComponentModel.PropertyDescriptor class to populate a new
PropertyDescriptorCollection. In your TypeConverter you can also subclass
SimplePropertyDescriptor, a nested and protected class in the TypeConverter
class, which is an easy way to define your own simple properties.
The FCL defines many *Converter implementations that you can use as well. One
particularly interesting TypeConverter is the ExpandableObjectConverter, which
you can assign to properties of your own classes (via TypeConverterAttribute)
that are complex types and should be expandable in the PropertyGrid itself as
a +/- node.
--
Dave Sexton
"Ron M. Newman" <co**********@confideltial.comwrote in message
news:u5**************@TK2MSFTNGP04.phx.gbl...
Hi,
I have a problem with dynamically putting dynamic properties on the property
grid. My app has no idea what it'll be showing at compile time.
How do I dynamically add properties to the property grid?
Thanks,
Ron