Conditional “Browsable” Attribute

前端 未结 6 757
梦谈多话
梦谈多话 2020-12-01 17:59


Is there a way to make a \"Browsable\" attribute conditional, so the property that applies it will sometimes appear in the properties page and sometimes not?
thanks

6条回答
  •  半阙折子戏
    2020-12-01 18:47

    There is no easy way.

    You can possibly work this out by implementing ICustomTypeDescriptor. Here is a good article about implementing ICustomTypeDescriptor.

    Or you can associate your own ControlDesigner with your class and override the PreFilterProperties method to add or remove properties viewed in the property grid.

    Removing certain properties from property grid.

提交回复
热议问题