【发布时间】:2015-10-07 06:01:39
【问题描述】:
我使用了 Xceed 属性网格。我已使用 Xceed 的集合编辑器在此属性网格中进行集合。
[Editor(typeof(CustomCollectionEditor), typeof(CustomCollectionEditor))]
[Serializable]
public class Variable
{
//Properties in Class
}
这里的自定义集合编辑器是从 Xceed 集合编辑器派生的。但是什么都没有被覆盖。它只是一个包装类。
Xceed 网站告诉展开以下过程: "PropertyGrid 支持这种情况,并允许您深入了解属性的层次结构。要启用此行为,您必须使用 ExpandableObject 属性装饰您的属性"
所以我在我的财产中使用它:
[ExpandableObject]
public List<Variable> GlobalVariableList
{
get { return _varlist; }
set { _varlist = value; }
}
但只有属性的计数显示在扩展中。而不是属性名称和值。
【问题讨论】:
-
Property Name 和 Value 很可能只是公共字段,您需要将它们变成公共属性,即在其定义中添加 {get;set;},以便它们可以通过 Xceed 属性网格显示.
标签: c# wpf propertygrid xceed collectioneditor