Hi!

I'm working on a project where I have classes displayed in a propertygrid control. Usually I could just assign some attributes to the classes, but they are generated from a scheme with a tool. So everytime I would regenerate the classes, the attributes would be deleted. So I need a way to hardcode these attributes to the property grid, I do not see another way. I thought I would just put in some if sentences for the typenames/propertynames and display my own strings on the propertygrid, but I do not know how...
Can anybody help?

Cheers!

Recommended Answers

All 2 Replies

Could you mark the generated class as abstract and create a descendant class, override the members, and mark them with attributes? This would allow you to persist your changes if the base class was regenerated. I have a few instances where I do something like this and I have a little utility where I paste in the generated code and it changes the access modifiers and I paste it back in to visual studio.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.