470,593 Members | 2,304 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,593 developers. It's quick & easy.

Propertygrid, associate property name with textual name possible?

Ger
The propertygrid is a great control, but I would like to show a more
descriptive text for the properties in the control. I tried to find a
solution within the system.componentmodel but did not succeed.
As far as I know I can only show the user the property name I use in my
class, like "cubic_inches". I would like the user to see something like
"Cylinder cubic inches".
Is it in any way possible to associate a text to the name of the property
and show that text in the property grid instead of the "internal" name of
the property?
Thanks,
John
Nov 21 '05 #1
5 1580

"Ger" <ge*********@rathernospam.sailsoft.nl> wrote
The propertygrid is a great control, but I would like to show a more
descriptive text for the properties in the control. I tried to find a
solution within the system.componentmodel but did not succeed.
As far as I know I can only show the user the property name I use in my
class, like "cubic_inches". I would like the user to see something like
"Cylinder cubic inches".
Is it in any way possible to associate a text to the name of the property
and show that text in the property grid instead of the "internal" name of
the property?

Check out this article in VS Help:

Getting the Most Out of the .NET Framework PropertyGrid Control

(In VS Help; Show the Index, type in PropertyGrid, and scroll down
to "customizing in the .NET framework" listed under "PropertyGrid control")

That article has more than could be reasonably posted here. Specifically
look at the DescriptionAttribute for adding your descriptions.

LFS

Nov 21 '05 #2
Ger,

Have a look how Microsoft uses it. And than you see they use names as
DataSource, so for you that would be
CylinderCubicInches, so why not confirm to that?

Just my thought,

Cor

"Ger" <ge*********@rathernospam.sailsoft.nl> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
The propertygrid is a great control, but I would like to show a more
descriptive text for the properties in the control. I tried to find a
solution within the system.componentmodel but did not succeed.
As far as I know I can only show the user the property name I use in my
class, like "cubic_inches". I would like the user to see something like
"Cylinder cubic inches".
Is it in any way possible to associate a text to the name of the property
and show that text in the property grid instead of the "internal" name of
the property?
Thanks,
John

Nov 21 '05 #3
Ger
Thank you Larry for your reply.
I did check that article earlier, but it provides no answer to my question.
I am not looking for a description, I know there is an attribute that
provides that as you also point out, but I would like to change the *name*
of the property in the propertygrid to be more descriptive to the user.
Ger.

"Larry Serflaten" <se*******@usinternet.com> schreef in bericht
news:ug**************@TK2MSFTNGP10.phx.gbl...

"Ger" <ge*********@rathernospam.sailsoft.nl> wrote
The propertygrid is a great control, but I would like to show a more
descriptive text for the properties in the control. I tried to find a
solution within the system.componentmodel but did not succeed.
As far as I know I can only show the user the property name I use in my
class, like "cubic_inches". I would like the user to see something like
"Cylinder cubic inches".
Is it in any way possible to associate a text to the name of the property and show that text in the property grid instead of the "internal" name of the property?

Check out this article in VS Help:

Getting the Most Out of the .NET Framework PropertyGrid Control

(In VS Help; Show the Index, type in PropertyGrid, and scroll down
to "customizing in the .NET framework" listed under "PropertyGrid

control")
That article has more than could be reasonably posted here. Specifically
look at the DescriptionAttribute for adding your descriptions.

LFS

Nov 21 '05 #4
Ger
Cor, thanks for your reply.
I *am* using notations like "CylinderCubicInches" in the grid. But I was
wondering if it was possible to make it more descriptive, and more flexible,
e.g. for localization purposes. In the mean time I found an example using
ICustomTypeDescriptor, but that seems quite complex. Anyway I will study it
tomorrow.
Ger.

"Cor Ligthert" <no************@planet.nl> schreef in bericht
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Ger,

Have a look how Microsoft uses it. And than you see they use names as
DataSource, so for you that would be
CylinderCubicInches, so why not confirm to that?

Just my thought,

Cor

"Ger" <ge*********@rathernospam.sailsoft.nl> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
The propertygrid is a great control, but I would like to show a more
descriptive text for the properties in the control. I tried to find a
solution within the system.componentmodel but did not succeed.
As far as I know I can only show the user the property name I use in my
class, like "cubic_inches". I would like the user to see something like
"Cylinder cubic inches".
Is it in any way possible to associate a text to the name of the property and show that text in the property grid instead of the "internal" name of the property?
Thanks,
John


Nov 21 '05 #5
On Sun, 28 Nov 2004 18:11:38 +0100, Ger wrote:
I *am* using notations like "CylinderCubicInches" in the grid. But I was
wondering if it was possible to make it more descriptive, and more flexible,
e.g. for localization purposes. In the mean time I found an example using
ICustomTypeDescriptor, but that seems quite complex. Anyway I will study it
tomorrow.


Using ICustomTypeDescriptor is the correct way to go. I have a class that
creates a "DisplayName" attribute to customize the name of the property in
the grid. If you're interested, let me know.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Zoury | last post: by
1 post views Thread by ANDRES BECERRA | last post: by
reply views Thread by hammad.awan_nospam | last post: by
7 posts views Thread by Ron M. Newman | last post: by
reply views Thread by Peter Gast | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.