Display list of user defined objects in propery grid

D

dushkin

Hi,

I know that to show class memebers in the property grid we need to
attribute each one of them with [Category("category name")].

But If I have a list, for example, of users (roughly) built in the
following way:

Class User {

public string name;
public int age;

}

private List<User> m_lstUsers;

and the m_lstUsers is the member I want to display in the property
grid, how do I do this?

When I attributted it with [Category("Mycategory")], then under the
"MyCategory" property I see something like <ClassName>.UsersListClass.
I hope it was clear enough.

Thanks!
 
J

Jeff Johnson

I know that to show class memebers in the property grid we need to
attribute each one of them with [Category("category name")].

But If I have a list, for example, of users (roughly) built in the
following way:

Class User {

public string name;
public int age;

}

private List<User> m_lstUsers;

and the m_lstUsers is the member I want to display in the property
grid, how do I do this?

When I attributted it with [Category("Mycategory")], then under the
"MyCategory" property I see something like <ClassName>.UsersListClass.
I hope it was clear enough.

Some links:

http://www.codeproject.com/search.aspx?q=property+grid+collection&sbo=kw
(the search I ran)

http://www.codeproject.com/Articles/5372/How-to-Edit-and-Persist-Collections-with-Collectio
(start here)

http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert
(this might interest you, too, but I recommend the collection editor)
 
D

dushkin

I know that to show class memebers in the property grid we need to
attribute each one of them with [Category("category name")].
But If I have a list, for example, of users (roughly) built in the
following way:
    Class User {
        public string name;
        public int age;
   }
   private List<User> m_lstUsers;
and the m_lstUsers is the member I want to display in the property
grid, how do I do this?
When I attributted it with [Category("Mycategory")], then under the
"MyCategory" property I see something like <ClassName>.UsersListClass.
I hope it was clear enough.

Some links:

http://www.codeproject.com/search.aspx?q=property+grid+collection&sbo=kw
(the search I ran)

http://www.codeproject.com/Articles/5372/How-to-Edit-and-Persist-Coll...
(start here)

http://www.codeproject.com/Articles/4448/Customized-display-of-collec...
(this might interest you, too, but I recommend the collection editor)

Thanks! I will check those.
 

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