【问题标题】:PropertyGrid & Object Property: CategoryPropertyGrid 和对象属性:类别
【发布时间】: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


【解决方案1】:

标准 MS PropertyGrid 中没有子类别。这意味着只有传递给 SelectedObject 的顶级对象才会被分类。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-15
    • 2014-08-19
    • 2015-11-15
    • 1970-01-01
    • 2011-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多