Problem with UITypeEditor invoked from multiple objects (Bug?)

M

Michael Kairys

I have a class, call it Outer, with a property of class Inner. Inner has a
type editor, InnerEditor, which presents a dialog containing a property
grid.

Now, I put several instances of Outer in a property grid and let the grid
merge them. When I click on the Inner property and get my InnerEditor, what
I want to see is a merge of the several Outer.Inner instances. How, I
wonder, can I make this happen.

So I set a breakpoint in InnerEditor's EditValue method and invoke it from a
property grid showing multiple instances of Outer. Imagine my excitement
when I look at the ITypeDescriptorContext argument and discover that, in
this case, it is an array of Outer objects! Perfect! All I need do is make
an array of Outer.Inner objects and give it to the SelectedObjects property
of InnerEditor's propety grid, and I will get the merge I want.

Now imagine my disappointment when I discover that this array of Outer
objects is *not* the array I originally put in the grid. It has the correct
number of items, but *they are all the same*. Specifically, they are all
copies of the first Outer object.

Is this a bug? If not, what purpose could it possibly serve?

Shouldering my distress, I turn my attention to the other argument,
IServiceProvider. Well, it looks interesting; in the single-object case it
is of type PropertyDescriptorGridEntry and in the multiple-object case it is
of type MultiPropertyDescriptorGridEntry, but both these types are in
PropertyGridInternal and are not available to me.

So how can I do this?
 
S

SBendBuckeye

Hello Michael,

I am having the same problem. Did you ever come up with any kind of
work-a-round? Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top