CollectionEditor Design Question

Topics: Building and extending application blocks
Nov 4, 2007 at 4:22 AM
Edited Nov 4, 2007 at 4:23 AM
Hey all!

I'm knee-deep in learning the Design-side of development now with my first application block. I have everything pretty much done, however, I'm having a problem with getting access to the current node hierarchy from an editor spawned from a collection editor.

Here's the deal. I have a node that has a property that is a collection of mappings. Once I invoke that editor and add a mapping in it, I can then edit one of the properties on this mapping that in turn has an editor that I built.

However, when I call ServiceHelper.GetCurrentHierarchy(provider) from this context it returns null. What I'm looking to do is get access to the property that spawned off the collection editor, but I'm unsure of exactly how to do this.

Does anyone know the answer to this? :)

Overall I've been very freaking impressed with how easy it's been to get this application block together! Major props to the whole team for making this incredible infrastructure. It's very sexy. :)
Nov 4, 2007 at 4:43 PM

Well I sure wish I could delete this. :)

I figured it out. The collection type loaded in the editor wasn't of type ConfigurationNode. I went ahead made it extend from ConfigurationNode and was able to get it to work!
Nov 5, 2007 at 7:45 PM
Well on further review, it appears that using ConfigurationNodes isn't the way to go. :)

The problem stems from when I'm editing a collection of objects within a CollectionEditor. If I edit a property of an item that has a modal-type editor, when EditValue() is called, the ITypeDescriptorContext and IServiceProvider are both the System.Windows.Forms.PropertyGridInternal.GridEntry from the CollectionEditor.

When I call IServiceProvider.GetService(), to look for my service, it returns null. I don't get this problem when I edit a property outside of a CollectionEditor.

I'm basically looking to access the hosting context of the CollectionEditor and poll its IServiceProvider. Is there a way to do this?