I have a PropertyGrid on my form. My boss thinks it’s ugly. Uncouth. Unsophisticated.
He wants a nice, neat, clean form. Here’s the catch: One of the properties is a collection of our home-grown objects. He likes the collection editor for this collection.
I know I can build my own collection editor. But is there a clean, simple solution to save me a few hours of coding, such that I can create and use a Collection editor directly without using the property grid?
You can get this functionality from the
UITypeEditor(viaTypeDescriptor), but it isn’t trivial – you need to set up anIServiceProvider, anIWindowsFormsEditorService, and ideally anITypeDescriptorContext– quite a bit of faff. It might be simpler to do it by hand if you aren’t familiar with those tools.Alternatively – take a look at SmartPropertyGrid.NET, an alternative to
PropertyGrid.Update: here’s a working example… definitely non-trivial, but feel free to steal the code. It only works for modal editors, not drop-down. It also isn’t a great example of ‘separation of concerns’. The
MyHelperclass is the interesting one.