• Welcome to Valhalla Legends Archive.
 

Hide inherited members in PropertyGrid

Started by K, July 07, 2006, 04:17 PM

Previous topic - Next topic

K

I'm working on a user control for a project of mine, and I would like to save a lot of time and effort by letting the user edit the properties of another user control via the PropertyGrid.  However, I'd like to just show the members that I have created, not the ones inherited from Control.  Is there an easy way to accomplish this? I looked at the AttributeCollection (or whatever), but it did not seem to contain the information I wanted.

MyndFyre

Implement ICustomTypeDescriptor either on the class itself or on another object, and if you implement it on the class itself I suggest using explicit interface implementation (AttributeCollection ICustomTypeDescriptor.GetAttributes() { /*...*/ }) for best OO style.

At the very least I think you'd need to provide custom implementations of GetProperties(), GetDefaultProperty(), GetEvents(), and GetDefaultEvent().

When you implement ICustomTypeDescriptor, the PropertyGrid control uses that instead of its own reflection system to bind its data.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.