Display properties in PropertyGrid


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
 
Ad

Advertisements

G

Gabriel Lozano-Morán

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
 
G

Guest

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
 
A

Andreas Mueller

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
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top