![](/img/trans.png)
[英]PropertyGrid - how to add ability to reset property of collection type in design-time
[英]Change Property Attribute Like ReadOnly at Design-Time (PropertyGrid)
我开发了一个自定义控件,其中包含以下字段:
ControlKind,Field1,Field2
我想改变每个controlKind的一个字段的属性,
如:如果controlKind == useField1,那么Field1 show和Field2 hidde in properyGrid(或readonly或filter)
我可以做吗 ?
提前致谢
实现ICustomTypeDescriptor,或注册TypeDescriptionProvider并从中返回自定义类型描述符,或应用TypeConverterAttribute。
在所有这三种情况下,您需要实现/覆盖GetProperties方法以返回实际属性的已过滤子集。 (在TypeConverter方法中,您还必须重写GetPropertiesSupported以返回true。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.