开发者

Expand a class instance within a class instance in PropertryGrid

In C#, I have a class set up like so:

class Page
{
  public class Element
  {
   private string test;
   public string Test
   { get { return test; } set { test = value; } }
  }

 private Element element;
 public Element PrimaryEl开发者_如何转开发ement
 { get { return element; } set { element = value; } }
}

If I have a PropertyGrid where the select object is an instance of Page, how can I modify Test in its member PrimaryElement from the PropertyGrid? It shows up in grey and is not expandable nor editable.


Add this to your Element type or to your PrimaryElement property:

[TypeConverter(typeof(ExpandableObjectConverter))]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜