怎样隐藏PropertyGrid中的集合编辑器
怎样隐藏PropertyGrid中的集合编辑器
我的集合定义如下:
public class ObjList<T> : CollectionBase, ICustomTypeDescriptor
{
}
谢谢!
------解决方案--------------------在你的类 集合 属性上加一个标签:
[EditorAttribute(typeof(CustomUITypeEditor), typeof(System.Drawing.Design.UITypeEditor))]
public List<T> T { get; set; }
新建一个类 CustomUITypeEditor:
public class CustomUITypeEditor: System.Drawing.Design.UITypeEditor
重写
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context){
return System.Drawing.Design.UITypeEditorEditStyle.None;
}