property grid and classes

liquid8

Active member
Joined
Jan 14, 2003
Messages
31
I am currently using a property grid to show the properties of a class Appearance. This has all the appearance properties of a BaseObject. I have an ObjectImage class that inherits BaseObject, and has its own Appearance class which shadows the BaseObject class. When I set up the property grid to show the properties for ObjectImage, it only shows me the BaseObject properties. What am I doing wrong?

Thanks,
LiQuiD8
 
I may not have explained this well enough for anyone to answer. I sort of solved the problem, but not the way I wanted to.

Basically I have a BaseObject Class, and want to have a seperate class with properties for Appearance, Data, etc.. The way I am currently doing this is:

Public Class BaseObject

Public Appearance as New Appearance

End Class


Public Class Appearance
Public Property Font() as Font
Public Property Color as Color
End Class

In Code, I create a new instance of the BaseObject:

Dim newObject as new BaseObject

I can successfully set all the underlying Appearance properties from the code, such as newObject.Appearance.Font, but setting the property grid to newObject, does not allow me to access the Appearance properties.

Right now I just put all the properties in the same class, and Categorized them, but I want to have seperate classes for different property types.

Any help would be appreciated.

Thanks,
LiQuiD8
 
You want the appearance property of your first class to be expandable in the property grid?
 
you got it :) right now I just threw all the properties into the objects class, and used <category>

Public Class BaseObject

<Category("Appearance")> _
Public Property Opacity

End Class

but i would like to keep my appearance properties all in a seperate class

LiQuiD8
 
You need to make a TypeConverter for your Appearance class that derives from ExpandableObjectConverter. You link the two together by sticking a TypeConverterAttribute on the Appearance class.
 
Back
Top