xceed Propertygrid - how to use a property collection

2k Views Asked by At

I try to use the great propertygrid from exceed.wpftoolkit but I have to problems based on the application I have to create.

First I didn't know at compile time the number of properties the grid has to show. So I couldn't use a simple class with properties/attributes and annotations as datacontext or source for the grid, I need a list or dictionary in which I place a number of grid properties at runtime. I google for several hours and try to find an example in the sample folders of the toolkit sources but nothing has help me. Second problem or apply is to replace the usage of annotations in the property class. I need to create the properties at runtime and place the propertyeditor and annotation settings at runtime to the property.

Could anybody help me with some simple examples or good places to look for. I believe the propertygrid is very powerful and could do this.

1

There are 1 best solutions below

0
On

You need to create a class that implements the ICustomTypeDescriptor interface to provide all the PropertyDescriptor instances that represent your dynamic properties.

After that you can set an instance of the class that implements the ICustomTypeDescriptor interfaces as SelectedObject to the PropertyGrid.

You can find an example here.