如何显示或PropertyGrid中的动态隐藏属性?属性、动态、PropertyGrid

2023-09-04 11:52:18 作者:永远不是我想要的明天`

我使用的是PropertyGrid的配置对象。我需要能够隐藏或显示这取决于其它属性的值一些属性。这可怎么实现的?我知道可浏览属性,但它只能在编译时。

I am using a PropertyGrid for configuring objects. I need to be able to hide or show some properties depending on the values of other properties. How this can be achieved? I know about Browsable attribute, but it only works at a compile time.

推荐答案

看看到的 ICustomTypeDescriptor 接口。

Take a look into the ICustomTypeDescriptor Interface.

在如何使用它可以在本文中找到进一步的信息:

Further informations on how to use it can be found in this article:

弯曲的.NET PropertyGrid中你会的。