PropertyGrid? Selecting an object from a dropdown list?

  • Thread starter Thread starter SVD
  • Start date Start date
S

SVD

Say ClassA has a collection of Class2 objects and a single Class1 object.

public class ClassA
{
CustomFieldCollection class2Objects = new CustomFieldCollection();
Class1 class1 = new Class1();
}

public class Class1
{
Class2 class2 = null;
}

public class Class2
{
int id;
string name;
}

To set the class1.class2 property, I would like to provide the user with a
drop down selection list of all the Class2 objects in my collection and
simply let them select the one they want. I'm able to display enums and hard
coded strings in a dropdown selection list, but that's NOT what I'm trying
to do here. I want to display a list of objects that are not hard coded
upfront.

Any suggestions, or better yet code, would be greatly appreciated.

Thanks,

Steve
 
As far as I understand,
If you are using PropertyGrid and
not implementing other designer infrastructure you will need implement
your UITypeEditor for Class1.Class2 to achieve the goal.

BTW property grid displays properties. It does not display member values. So
you'll need public properties to provide access to the members discussed in
your message.
 
Back
Top