public class SupportApplications: object { public string Name { get; set; } = "{Please Set}"; public ExecutionTime ExecutionTime { get; set; } = ExecutionTime.BeforeLaunch; public ExecutionMode ExecutionMode { get; set; } = ExecutionMode.Exclusive; } public class ComputerVM : BaseVM { [Editor(typeof(GenericCollectionEditor), typeof(UITypeEditor))] public List SupportApplications { get { return Computer.BigBoxSupportApplications; } set { Computer.BigBoxSupportApplications = value; OnPropertyChanged(); } } } internal class GenericCollectionEditor : UITypeEditor { public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { if (context == null && context.Instance == null) return base.GetEditStyle(context); return UITypeEditorEditStyle.Modal; } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context == null || provider == null || context.Instance == null) return value; IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); Type type = value.GetType().GetGenericArguments().SingleOrDefault() ?? typeof(object); GenericCollectionEditorForm form = new GenericCollectionEditorForm((List)value, type); if (editorService.ShowDialog(form) == System.Windows.Forms.DialogResult.OK) { return form.Objects.ToList(); } return base.EditValue(context, provider, value); } } public partial class GenericCollectionEditorForm : FormViewBase { public List Objects { get; set; } private Type type = null; private BindingSource objectsBindingSource = new BindingSource(); public GenericCollectionEditorForm(List objects, Type type) { Objects = objects; this.type = type; objectsBindingSource.DataSource = Objects; MainLB.DataSource = objectsBindingSource; } private void AddBT_Click(object sender, EventArgs e) { if (type == null) return; Objects.Add(type); RefreshEffectListDataBindings(); } private void MainLB_SelectedValueChanged(object sender, EventArgs e) { MainPG.SelectedObject = MainLB.SelectedItem; } private void RefreshEffectListDataBindings() { MainLB.DataSource = null; MainLB.DataSource = objectsBindingSource; } private void DeleteBT_Click(object sender, EventArgs e) { if (MainLB.SelectedItems.Count == 0) return; Objects.Remove(objectsBindingSource.Current); RefreshEffectListDataBindings(); } }