【问题标题】:Property Grid:Dispay a property value only if it is not null属性网格:仅当属性值不为空时才显示它
【发布时间】:2012-04-23 06:09:43
【问题描述】:

我在其中一个 UI 中使用属性网格 (System.Windows.Forms.PropertyGrid) 来显示类的属性。 有时,我要显示的对象的某些属性可能是空值。 所以在这里我在 propertygrid 中看到该属性的一行,并且值为空。 是否有任何选项可以在此属性为空时隐藏此属性。

【问题讨论】:

  • 我可以看到该属性可以通过使用 Browsable 属性隐藏显示。但是根据财产的价值怎么办呢?

标签: user-interface controls propertygrid .net


【解决方案1】:

propertydescription中的Browsable属性可以通过反射设置,可以隐藏值。

http://codinglight.blogspot.de/2008/10/changing-attribute-parameters-at.html

【讨论】:

    最近更新 更多