all groups > dotnet windows forms > july 2005 >
You're in the

dotnet windows forms

group:

Problem with UITypeEditor invoked from multiple objects (Bug?)


Problem with UITypeEditor invoked from multiple objects (Bug?) Michael Kairys
7/29/2005 11:42:22 AM
dotnet windows forms: 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?

--
Michael Kairys
Senior Engineer | SL Corporation | http://www.sl.com

Re: Problem with UITypeEditor invoked from multiple objects (Bug?) SBendBuckeye
9/20/2005 8:24:13 AM
Hello Michael,

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



AddThis Social Bookmark Button