【发布时间】:2013-07-27 12:31:56
【问题描述】:
我正在从事一个涉及查看和更改 具有 PropertyGrid 控件的类元素的属性。这 类元素的属性是对其他对象的引用 (自己)有属性。
[TypeConverter(typeof(ExpandableObjectConverter))]
public abstract class Elemento
{
....
[CategoryAttribute("Materiale Associato 1"), DescriptionAttribute("Caratteristiche standard del Materiale 1")]
public Standard1 Standard1 {get;set;}
[CategoryAttribute("Materiale Associato 2"), DescriptionAttribute("Caratteristiche standard del Materiale 2")]
public Standard2 Standard2 {get;set;}
}
此对象将传递给 SelectedObject 属性 (PropertyGrid)。 我想将 Standard1(和 Standard2)类的属性划分为 类别。我尝试用这种方式装饰属性:
[TypeConverter(typeof(Standard1Converter))]
public class Standard1
{
[CategoryAttribute("Property1")]
public AnObject Property {get;set;}
[CategoryAttribute("Property2"), DescriptionAttribute("A property")]
public AnObject Property2 {get;set;}
但属性未分组。我只看到描述。怎么了?
NB:Standard1Converter:ExpandableObjectConverter
【问题讨论】:
-
“他的属性没有分组”是什么意思。你到底期待什么?
-
当我选择一个 Elemento 时,我看到(在 propertyGrid 中)按类别分组的属性(作为 Standard1),但是当我“展开”对象 Standard1 时,相关属性没有被分类。对不起我的英语不好!
标签: c# propertygrid