John,
This can be definitely done. There are two things you need to localize -
property names and category names.
The category are easy to localize. Just inherit your own class from the
CategoryAttribute and override its GetLocalizedString virtual method. This
method is called by the Category property first time the property is read.
Here you need to return your localized version of the category name.
With the property names it is not that easy. The property grid uses
PropertyDescriptor objects to display and manipulate object proeprties. For
the property name it reads the DisplayName property of the
PropertyDescriptor. DisplayName is virtual, but read only so it can be only
override to return localized version of the property name. I believe you can
create your own PropertyDescriptor class that iherits from the
PropertyDescriptor and overrides DisplayName p then you can create
TypeConverter the return colleciton of this special property descritors for
the class properties upon calling GetProperties method.
You can also implement a ICustomTypeDescriptor interface
Actually I looked around on the net and I found pretty good article for you
with a sample code
http://www.codeproject.com/cs/miscct..._revisited.asp
HTH
--
Stoitcho Goutsev (100)
"John Allen" <no_spam@_nospam.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi there,
Does anyone know if the standard "PropertyGrid" control is (foreign)
language sensitive. If I display an object in the control, and my object
has the native .NET "Size" struct as a property (which also contains its
own ""Width" and "Height" members), will someone running my app on a
German version of Windows for instance still see "Size", "Width" and
"Height" in the property window. Or does it get translated into German
accordingly. If not then how would I translate it. Thanks.