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

PropertyGrid "help on each property"

P: n/a
Someone introduced me to PropertyGrid last night. It is a great feature for
what I need. A question though. I noticed that when I assign a "TextBox"
control to a property grid the description on each property is shown at the
bottom of the grid. Also, properties are divided into categories.

How can I do this with my own defined objects?

For example: I would like Name to be in one category with a description for
it and Days to be in another category with a description for it.

public Class A
{
public enum Days {Mon, Tue, Wed, Thu, Fri};
private Days days;
private string name;
public Class A() {}
public Days WeekDays
{
get { return days; }
set { days = value; }
}
public string AName
{
get { return name; }
set { name = value; }
}
}
--
Steve
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steve,

In order to place a property in a certain category, apply the Category
attribute to the property with the name of the category you want the
property to appear in. This will cause all properties with the same
category to be grouped together.

To display a description, apply the Description attribute to the
property, and then it will show that string in the propertygrid.

Both attributes are in the System.ComponentModel namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Teeples" <St**********@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
Someone introduced me to PropertyGrid last night. It is a great feature
for
what I need. A question though. I noticed that when I assign a "TextBox"
control to a property grid the description on each property is shown at
the
bottom of the grid. Also, properties are divided into categories.

How can I do this with my own defined objects?

For example: I would like Name to be in one category with a description
for
it and Days to be in another category with a description for it.

public Class A
{
public enum Days {Mon, Tue, Wed, Thu, Fri};
private Days days;
private string name;
public Class A() {}
public Days WeekDays
{
get { return days; }
set { days = value; }
}
public string AName
{
get { return name; }
set { name = value; }
}
}
--
Steve

Nov 16 '05 #2

P: n/a
This was perfect! Thanks.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Steve,

In order to place a property in a certain category, apply the Category
attribute to the property with the name of the category you want the
property to appear in. This will cause all properties with the same
category to be grouped together.

To display a description, apply the Description attribute to the
property, and then it will show that string in the propertygrid.

Both attributes are in the System.ComponentModel namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Teeples" <St**********@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
Someone introduced me to PropertyGrid last night. It is a great feature
for
what I need. A question though. I noticed that when I assign a "TextBox"
control to a property grid the description on each property is shown at
the
bottom of the grid. Also, properties are divided into categories.

How can I do this with my own defined objects?

For example: I would like Name to be in one category with a description
for
it and Days to be in another category with a description for it.

public Class A
{
public enum Days {Mon, Tue, Wed, Thu, Fri};
private Days days;
private string name;
public Class A() {}
public Days WeekDays
{
get { return days; }
set { days = value; }
}
public string AName
{
get { return name; }
set { name = value; }
}
}
--
Steve


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.