I'm hosting a PropertyGrid control. The objects being edited contain some properties that have custom editors assigned to them.
All editors implement this method:
object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
What I'm trying to figure out is where the "IServiceProvider provider" comes from, or how to extend it. I want to be able to implement additional services in the host application, and allow type editors to retrieve those services using provider.GetService(typeof(MyService)).
I've tried deriving from PropertyGrid and overriding its GetService method, but couldn't get that to work. I've also tried implementing an ISite interface and assigning it to the Site property of the PropertyGrid, and couldn't get that to work either. I don't know whether I was just missing something simple, or was completely on the wrong track. Either way, these points are for a working example of how to expose a custom service to a type editor.