カスタム CollectionEditor とカスタム PropertyDescriptor クラスを作成する必要があります。PropertyDescriptor は、PropertyDescriptor.GetEditor をオーバーライドすることによって、コレクション エディターに渡される PipeLine オブジェクトを格納できます。PipeLine に新しい Markers オブジェクトを作成させ、必要な初期化を実行させることができます。
開始するためのコードを次に示します。
public class MyCollectionEditor : System.ComponentModel.Design.CollectionEditor
{
private Pipeline _pipeline;
public MyCollectionEditor(Type type) : base(type) {}
public MyCollectionEditor(Type type, Pipeline pipeline) : base(type)
{
_pipeline = pipeline;
}
protected override object CreateInstance(Type itemType)
{
return _pipeline.CreateNewMarker();
}
}
public class MyPropertyDescriptor : PropertyDescriptor
{
private PipeLine _pipeline;
public MyPropertyDescriptor(PipeLine pipeline) : base(name, null)
{
_pipeline = pipeline;
}
public override object GetEditor(Type editorBaseType)
{
return new MyCollectionEditor(typeof(MarkerCollection), _pipeline);
}
// ... other overrides ...
}
// ...
// Implement System.ComponentModel.ICustomTypeDescriptor.GetProperties
public System.ComponentModel.PropertyDescriptorCollection GetProperties()
{
PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(null);
foreach (Marker m in Markers) {
MyPropertyDescriptor pd = new MyPropertyDescriptor(m);
pdc.Add(pd);
}
return pdc;
}