我使用过 Xceed Property Grid。我在这个 Property Grid 中使用了 Xceed 的 Collection Editor for Collections。
[Editor(typeof(CustomCollectionEditor), typeof(CustomCollectionEditor))]
[Serializable]
public class Variable
{
//Properties in Class
}
此处自定义集合编辑器派生自 Xceed 集合编辑器。但是什么都没有被覆盖。它只是一个包装类。
Xceed 网站讲述了以下扩展过程: “PropertyGrid 支持这种情况,并允许您深入了解属性的层次结构。要启用这种行为,您必须使用 ExpandableObject 属性装饰您的属性”
所以我在我的属性(property)中使用它作为:
[ExpandableObject]
public List<Variable> GlobalVariableList
{
get { return _varlist; }
set { _varlist = value; }
}
但是Expanding this中只显示了Properties的Count。而不是属性名称和值。
最佳答案
我认为您的 customcollectioneditor 需要在集合而不是项目上。
关于c# - Xceed 属性网格 : Collection Editor Not Expanding In Proper Manner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31477116/