Custom Menu Strip Control using Items Collection Editor

278 Views Asked by At

I have created a custom menu strip control and am trying to utilize the 'Items Collection Editor' that appears for the basic menu strip items. What appears is the ToolStripItem Collection Editor. While the ToolStrip editor might suffice, when click Add, an error appears "Cannot create an abstract class."

Any thoughts are greatly appreciated.

    [Category("Menu Options")]
    [Description("Collection of items to appear on the menu.")]
    [Editor(typeof(CollectionEditor), typeof(UITypeEditor))]
    //[Editor(typeof(MenuItemCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [Browsable(true)]
    //public ToolStripItemCollection Items { get; } = new ToolStripItemCollection(constructStrip, new ToolStripItem[]);

    public ToolStripItemCollection MenuItems
    {
        get { return mnuMain.Items; }
        set
        {
            mnuMain.Items.Clear();
            foreach (var elem in value)
            { mnuMain.Items.Add((ToolStripItem)elem); }
        }
    }
0

There are 0 best solutions below