This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I guess this technically could be a design choice, but if so it's certainly an unexpected gotcha. -d Short summary : TypeConverter attributes are not honored when using Multiple Object display (SelectedObjects collection).
Long Repro: Using the QuickStart project: 1) modify Person.cs as follows: using System;
2) modify SampleObjects.cs as follows: using System; 3) Run the QuickStart project and launch the "...using multiple selection" demo.
Note that the *Multiple* object property grid has not used the TypeConverter provided (the secret property is exposed) - whereas both of the *Single* object property grids have done so (the secret property is hidden).
|
|
|
(very rude reply-to-self-apologies) PS: Yes, I know this TypeConverter behaviour could be implemented in other ways, but it's just illustrating the issue. The behaviour I'm actually trying to use in my case is significantly more complex and relies on runtime only data. |
|
|
I have committed a fix for this and it should be working correctly in nightly builds dated 4 Aug 2009 and above, available from about 1430 GMT. Thanks for letting us know about the problem. |
|
|
Very close, works for the testcase I gave perfectly but now unfortunately I've found a followup issue. In short: MultipleObjectWrapper.GetValue() doesn't seem to use the TypeConverter, and because of this there are no properties - which goes boom. Rather than fill the forums with code I've attached the two files that need to change to expose the problem. They should be applied to a vanilla QuickStart sample rather than a modified one. Yes, it's somewhat convoluted, but that's unfortunately what I'm working with. Of course, I've skipped implementing notifypropertychanged etc on the wrappers so you'll notice in this that things don't always update. A suggested fix seems to be something like (in MultipleObjectWrapper.GetValue()): TypeConverter converter = TypeDescriptor.GetConverter(obj); if ((converter != null) && (converter.GetPropertiesSupported())) |
|
|
oops, try: if (obj != null)
|
|
|
Ah, sorry about that -- didn't realise you were adding properties so neglected to test that scenario. Many apologies. I've committed a fix and it will be in the 7 August nightly. |
|