【发布时间】:2012-02-29 16:24:53
【问题描述】:
如果我有一个类似以下的类,其代码无法更改,如何在运行时将 EditorAttribute 添加到 s1?
class TestClass
{
public String s1 {get;set;}
public String s2 {get;set;}
}
我尝试了这种方法,但它也向 s2 添加了一个 EditorAttribute 编辑器,我不想要那个。
TypeDescriptor.AddAttributes(
typeof(String),
new EditorAttribute (
typeof(MyUITypeEditor),
typeof(UITypeEditor)));
我该怎么做?
【问题讨论】:
标签: c# propertygrid addattribute