StringDictionary not serialized properly when edited through a custom editor in the winform designer
I'm creating a user control with a StringDictionary property. I'm displaying a custom editor for this propery in the control property grid with the following code :
public partial class SomeUserControl : UserControl
{
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Editor("System.Diagnostics.Design.StringDictionaryEditor,System.Design", "System.Drawing.Design.UITypeEditor, System.Dra开发者_开发技巧wing")]
public StringDictionary Items { get; set; }
public SomeUserControl()
{
Items = new StringDictionary();
InitializeComponent();
}
}
The designer appears correctly in the winform designer when I click on the property. However, when I edit the values they are not serialized in the form.
Am I missing something? Or is it not supported by the StringDictionaryEditor?
Many thanks.
StringDictionary does not implement IList and ICollection which are required for DesignerSerializationVisibility.Content to work.
精彩评论