User Control的呈现问题

如果自定义用户控件使用了List或其它集合属性,在vs 里的design view下呈现出错。
解决方法,在该属性上添加:
[System.ComponentModel.DesignerSerializationVisibility(
System.ComponentModel.DesignerSerializationVisibility.Content)]
而对于List,为了使用字符串集合,还可以添加:
[System.ComponentModel.Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design",
"System.Drawing.Design.UITypeEditor, System.Drawing")]

1) http://blogs.msdn.com/toub/archive/2004/10/12/241277.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *