enum ClassType
{
BASE,
A,
B
}
class BaseClass
{
ClassType CT;
//some fields
}
class AClass : BaseClass
{
//some fields
}
class BClass : BaseClass
{
//some fields
}
class Holder
{
public List<BaseClass> list { get; set; }
}
Then I have a collection List<BaseClass> list;
If I load Holder's instance as PropertyGrid.SelectedObject, I will be able to add, edit and remove elements in collection, but I could add ONLY BaseClass and what I want is the choice of what class to add in the list.
Is this possible without making my own collection editor?
Need something like that for ContextMenuStrip.Items editor, but I don't know how it's made.
You might want to try inheriting from it and overriding the NewItemTypes property:
You will need to add an EditorAttribute to your collection type to specify your inherited editor.