Marek,
Have you seen this somewhere in the standard framework controls? If you have
then you can try with the reflector to find out what type of editor
micorosoft guys use. Sometimes it is possible to reuse their. If there is
nothing out of the box I'm afraid you need to write your own as you've
already started.
--
Stoitcho Goutsev (100)
"Marek" <(E-Mail Removed)> wrote in message
news:2E95DB79-4D01-438B-A782-(E-Mail Removed)...
> Hi Stoitcho
> Sorry for the confusion, it's a bit hard to get my requirements down on
> paper!
>
> The question is how to display an object's property (called MyCollection
> say) where the MyCollection property is a class implemented as follows:
>
> class MyCollectionClass : IDictionary<string, MyObjectType>
>
> so that when the object is displayed in the property grid the user can
> expand the MyCollection property with say an ellipsis button and then add
> and
> remove objects of the type specified by IDictionary<key, MyObjectType> and
> set their values in a manner similar to that had I used List<MyObjectType>
> for example.
>
> My current line of attack is as follows:
>
> [Editor(typeof(MyCollectionEditor),
> typeof(System.Drawing.Design.UITypeEditor))]
> public MyCollectionClass
>
> and then in MyCollectionEditor to the override GetEditStyle and EditValue
> and to display a custom form which allows the user to edit the collection
> and
> its contents. The second question therefore is is this approach the right
> one in a .NET2 world?
>
> I hope this makes sense.
>
> Marek
>
> "Stoitcho Goutsev (100)" wrote:
>
>> Marek,
>>
>> What was the question. I kind of missed it. What is that you want to
>> achieve?
>>
>>
>> --
>> Stoitcho Goutsev (100)
>>
>> "Marek" <(E-Mail Removed)> wrote in message
>> news:CC464D8A-03CA-45A0-B35F-(E-Mail Removed)...
>> > Hi
>> > I have a class which has a property which implements IDictionary which
>> > I
>> > would like to display in a propertygrid control. If I add
>> > [TypeConverter(typeof(ExpandableObjectConverter))] the property
>> > expands,
>> > but
>> > I only get Count, IsReadOnly, Keys and Values properties, all of which
>> > are
>> > disabled.
>> >
>> > If I implement my property as Dictionary<string, myObj> I get the
>> > option
>> > to
>> > click on the keys and the values, but these then bring up the input
>> > dialog
>> > into which I can't add any new values (for good reason).
>> >
>> > List<myObj> works fine of course.
>> >
>> > I have googled around and found some articles, but none of these seemed
>> > to
>> > work.
>> >
>> > Please could anyone advise as to the best way to solve this problem.
>> >
>> > Marek
>>
>>
>>
|