繁体   English   中英

在设计时更改属性属性,如ReadOnly(PropertyGrid)

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM