using System.Collections.Generic;
using System.ComponentModel.Design;
namespace Netron.Diagramming.Core {
///
/// This editor is used to edit items from e.g. the via the property grid. This is a generic editor so it
/// can be used to edit any collection of items.
///
///
public class ShapeMaterialCollectionEditor : CollectionEditor where T : IShapeMaterial {
///
/// Initializes a new instance of the class.
///
public ShapeMaterialCollectionEditor()
: base(typeof(List)) { }
///
/// Sets the items.
///
/// The edit value.
/// The value.
///
protected override object SetItems(object editValue, object[] value) {
CollectionBase entries = editValue as CollectionBase;
entries.Clear();
for (int k = 0; k < value.Length; k++) {
entries.Add(value[k] as IShapeMaterial);
}
object retValue = base.SetItems(entries, value);
return retValue;
}
}
}