4

I have an array of objects containing pairs of string labels and values, how would I put them all in a single property grid?

    public class stringVariable {
        public String name;
        public String defaultValue;
        public String value;
    };
    public List<stringVariable> variables = new List<stringVariable>();
John Saunders
  • 160,644
  • 26
  • 247
  • 397
Tom J Nowell
  • 9,588
  • 17
  • 63
  • 91

2 Answers2

3

Its not entirely straight forward, but possible. You need to have a class that implements ICustomTypeDescriptor, which will tell you what properties to display, etc. There are a few implementations out there, I was using this one: http://www.codeproject.com/KB/miscctrl/bending_property.aspx

Grzenio
  • 35,875
  • 47
  • 158
  • 240
0

Adding an array of objects to a property grid is pretty well covered in a number of tutorials. This should be what you're looking for.

John Feminella
  • 303,634
  • 46
  • 339
  • 357