By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,500 Members | 1,571 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,500 IT Pros & Developers. It's quick & easy.

Propertygrid, associate property name with textual name possible?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.