.net - c# UserControl property - setting list of string for custom property - List<string> -
after spending log of time not able solve problem.
i have list in usercontrol not able bind custom property @ design time. here design screenshot error
public partial class taglistcontrol : usercontrol { private hashset<string> _tags; private list<string> _tags; //[browsable(false)] // hiding because it's not working in //[editor("system.windows.forms.design.stringcollectioneditor, system.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a", typeof(uitypeeditor))] [designerserializationvisibility(designerserializationvisibility.content)] public list<string> tags { { _tags = _tags.tolist(); return _tags; } set { value = value ?? new list<string>(); _tags = value; value.foreach(x => { string[] tags = x.split(','); foreach (string tag in tags) { if (!string.isnullorempty(tag)) { _tags.add(tag.trim()); } } _tags.add(x); }); } } [browsable(true)] public bool allowmultipletags { get; set; } [browsable(false)] public int count { { return _tags.count; } } public taglistcontrol() { initializecomponent(); _tags = new hashset<string>(); } ..... }
can explain me how designer give user string list possible values? can add list of strings value 1 one.
Comments
Post a Comment