Author | Message | Time |
---|---|---|
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. | July 7, 2006, 9:17 PM |
Myndfyr | 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. | July 7, 2006, 9:42 PM |