lundi 13 février 2017

How to show the "Design" category in a custom CollectionEditor when overriding CreateInstance()?

Vote count: 0

If I comment out CreateInstance, then the "Design" is showing, but if I override it it is not showing. How can I make it shown?

No override:

enter image description here

Override:

enter image description here

Code:

public class MyEditor : CollectionEditor
{
    public MyEditor(Type type) : base(type)
    {
    }

    protected override Type[] CreateNewItemTypes()
    {
        return new[]
        {
            typeof(TabPage) //TabPage is subclass of "Panel".
        };
    }
    protected override object CreateInstance(Type itemType)
    {
        var item = new TabPage(true);
        return item;
    }
}

Also, the title of the collection editor window is "Object Collection Editor", instead of my collection's name such as "TabPage Collection Editor". Not a big problem, but I would like to fix this, if possible.

asked 15 secs ago

Let's block ads! (Why?)



How to show the "Design" category in a custom CollectionEditor when overriding CreateInstance()?

Aucun commentaire:

Enregistrer un commentaire