有条件的“可浏览"属性 [英] Conditional "Browsable" Attribute

查看:22
本文介绍了有条件的“可浏览"属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


有没有办法使可浏览"属性有条件,因此应用它的属性有时会出现在属性页面中,有时不会出现?
谢谢:)


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 :)

推荐答案

没有简单的方法.

您可以通过实现 ICustomTypeDescriptor 来解决这个问题.这是一篇关于实现 ICustomTypeDescriptor 的好文章.

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

或者你可以关联你自己的ControlDesigner 与您的班级并覆盖 PreFilterProperties 方法添加或删除在属性网格中查看的属性.

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.

删除属性网格中的某些属性.

这篇关于有条件的“可浏览"属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆