void EditObjectList() { if (mOwner != null) { CollectionEditor.EditValue(mListView, mOwner, mName); ShowData(); } }
public static bool EditValue(IWin32Window owner, object component, string propertyName) { PropertyDescriptor prop = TypeDescriptor.GetProperties(component)[propertyName]; if (prop == null) { throw new ArgumentException("PropertyName [" + propertyName + "] in object not found."); } UITypeEditor editor = (UITypeEditor)prop.GetEditor(typeof(UITypeEditor)); CollectionEditor ctx = new CollectionEditor(owner, component, prop); if (editor != null && editor.GetEditStyle(ctx) == UITypeEditorEditStyle.Modal) { object value = prop.GetValue(component); value = editor.EditValue(ctx, ctx, value); if (!prop.IsReadOnly) { prop.SetValue(component, value); return(true); } } return(false); }