Display properties in PropertyGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, NG!
Does anyone have any hint on how to get the PropertyGrid control to display
more user-friendly "property" names, i.e. names that contain spaces, just
the way the VS IDE does when you select a file in Solution Explorer to view
its properties ("Build Action", "Copy to Output Directory" etc)? How are
those strings displayed since they don't seem to be real property names as
they contain spaces? I'm trying to achieve this in C#...

Thanks in advance.



pax
 
If you are trying to display properties for a class you control you can
implement the ICustomeTypeDescriptor interface found in the
System.ComponentModel namespace, override the GetProperties() and create
your own PropertyDescriptors overriding the DisplayName property.

Gabriel Lozano-Morán
MCSD .NET
Real Software
http://www.realdn.net
http://www.realsoftware.be
 
Thanks a lot, Gabriel. There's a lot of information in your swift reply, I
hope I'll be able to find my way through...
And yes, the class should be mine, I guess there would be nothing to expect
if it were not mine.

Thanks.


pax
 
Gabriel said:
If you are trying to display properties for a class you control you can
implement the ICustomeTypeDescriptor interface found in the
System.ComponentModel namespace, override the GetProperties() and create
your own PropertyDescriptors overriding the DisplayName property.

Gabriel Lozano-Morán
MCSD .NET
Real Software
http://www.realdn.net
http://www.realsoftware.be

Here's what I found a year ago when implementing property grid
customizations:

http://www.codeproject.com/vb/net/using_propertygrid.asp
http://www.codeproject.com/cs/miscctrl/customizingcollectiondata.asp
http://www.codeproject.com/vb/net/Propertygrid_Editor.asp
http://www.codeproject.com/csharp/DzCollectionEditor.asp

http://stup.org/blogs/nidhogg/archive/2004/02/18/279.aspx
http://www.codeproject.com/cs/miscctrl/DynPropGrid.asp

HTH,
Andy
 
Back
Top