Globalized Properties

Mar 27, 2010 at 10:08 PM

Hi,

I still had today a problem with globalized propertynames (as described in this articel: http://www.codeproject.com/KB/miscctrl/globalizedpropertygrid.aspx) that these properties are only shown with the "real" property name not with the one which should appear in case the overiden "DisplayName" of the PropertyDescriptor is called.

The problem is located in the PropertyCollection constructor in line 24:

 properties = TypeDescriptor.GetProperties(instance.GetType());  //I changed here from instance to instance.GetType, so that only the Direct Properties are shown!

If you change this line to

properties = TypeDescriptor.GetProperties(instance);

everything is working fine for the globalized objects, but I have no idea which sideeffects this will have on the PG and why only direct properties should be shown (so far I haven't found any).

Regards,
Chris

Coordinator
Mar 28, 2010 at 9:39 AM

If you try my examples, and change this line, you see, when you use

properties = TypeDescriptor.GetProperties(instance);
there are much more properties shown as when you use the other way.

I think (but i'm not sure that i'm right), that if i do it the first way, only the propetries wich are for that type directly, and not all others (like attached ones) are shown (but i'm not sure this is correct).
Maybe I change it back to your used syntax, but i will first do a few tests...