I don't know of any way. You can control the behaviour of individual
properties in the grid via the Browsable and ReadOnly attributes in the
System.ComponentModel namespace. I've always used a dedicated class as the
SelectedObject recipient. The dedicated class would contain a reference to
your derived class instance. It exposes properties equivalent to just those
on your derived class that you want to expose via the property grid. You can
then decorate the properties on the dedicated class with attributes to
control the behaviour of the grid. A good example of this would be when you
want a custom editor to be used for a property when its displayed in the grid.
This pattern is similar to how Microsoft does things in the Enterprise
Library configuration tool. Briefly, they have hierarchies of classes
derived from System.Configuration.ConfigurationElement. Each one does not
get exposed in a property grid directly. Instead it has an equivalent
ConfigurationNode-derived class exposing just the properties that are to be
visible in the grid.
Hope this helps.
David Razzetti
"John Olbert" wrote:
Is there a way to pass a class to the SelectedObject of PropertyGrid and have
it only show the properties in the child class and not those in the base
class's that it is derived from?
Thanks.
--
John Olbert