开发者

StringDictionary not serialized properly when edited through a custom editor in the winform designer

开发者 https://www.devze.com 2023-02-13 09:02 出处:网络
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 :

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消