As all my my doubts are used to vanish here... :) I have got an other question.
I have a custom control in which I have a list of strings List and I'd like the user of my control to be able to edit the list in the properties editor but I doesn't work.. I can click on the button to make the Collection editor visible but the add key is not enabled and there's a message 'Property editing is not available'.
I made a custom quick and dirty class
public class DataUrl
{
public string Url {get; set;}
public DataUrl() { }
public override string ToString()
{
return Url.ToString();
开发者_如何转开发 }
}
and with this it works but its... I suspect it doesn't work because string (or String) does not have a parameter-less constructor. I also tried to use the attribute
[NewItemTypesAttribute(typeof(string))]
but worthless.. Could someone help me ?
public class DataUrl : Component
{
private readonly List<string> _urlList = new List<string>();
public DataUrl() : base() {}
public DataUrl(IContainer container) : base()
{
container.Add(this);
InitializeComponent();
}
[Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public List<string> UrlList { get { return _urlList; } }
public override string ToString()
{
return Url.ToString();
}
}
精彩评论