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
|
Hi, we tried using your PropertyGrid with some dynamically generated proxy-classes and it seems that not everything behaves as we expected. The scenario is a little more complex, so I cannot provide a full sample, but I try to explain it: There is a "normal" object of some class T, which is normally readonly. When we need it to be editable, we use LinFu (http://code.google.com/p/linfu/) to generate an editable proxy-class at runtime, which implements basically the same interfaces as the original object, but now with working implementations of the property-setters. Both classes use the same CustomTypeDescriptor, which works nice when retrieving properties via However, using this proxy in the PropertyGrid does strange things:
To find out, what's wrong, I registered a custom type editor for the type bool, which does not set ObjectWrapper<bool>.Value but instead manually gets the property-owner and calls the set-method of the property with the new value -> voila, this way I don't get any strange behavior.
Looking at your source-code I got the impression that the PropertyGrid/ObjectWrapper uses Type.GetProperty("propName") and not the TypeDescriptor, which might lead to different results. Is there any way, how I can control the PropertyGrid, i.e. its way of reflecting object-properties? Or can you tell me, how I must customize my class/proxy to make it compliant to the PropertyGrid? |
|
|
We use PropertyDescriptors where possible (for normal properties); as far as I know we use PropertyInfo only for indexed properties (which PropertyDescriptor doesn't support). Certainly we have people using ICustomTypeDescriptor successfully on their objects. I appreciate that your real scenario is quite complex, but would it be possible for you to create a cut-down repro with just one or two sample classes and their proxies, so that we can investigate this and make any required fixes? Thanks! |
|
|
Sounds like our scenario should "normally" just work. Maybe it' something completely different. |
|
|
Problem solved: While trying to reproduce the problem, I found and fixed a bug in one of our PropertyDescriptors (ComponentType returned PropertyType), since then the problem has disappeared. Thanks for your help. |
|