2010-09-23 85 views
1

我正在写一个自定义控件(使用VS2010 & C#)并且它有一个可为空的日期时间的属性。为什么UITypeEditor“DateTimeEditor”在对象浏览器中不可见?

为什么说,定义我的财产的时候,我可以写这个...

[Editor("System.ComponentModel.Design.DateTimeEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] 
public DateTime? When 
{ 
    : 
} 

...但不是这个......

[Editor(typeof(System.ComponentModel.Design.DateTimeEditor), typeof(UITypeEditor))] 
public DateTime? When 
{ 
    : 
} 

为什么DateTimeEditor不可见在物件浏览器(例如)

感谢, 罗斯

回答

0

你必须添加引用System.Design为DatetimeEditor是在看得到对象浏览器。

+0

谢谢。最初,我无法添加对System.Design的引用,但那是因为我的项目的目标是“.Net Framework 4 Client Profile”。一旦更改为.Net4,它工作得很好。 – 2011-09-27 11:59:29

相关问题