简体   繁体   中英

xceed Propertygrid - how to use a property collection

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM