public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); ICollectionAApiVersionedFieldsCTD field = (ICollectionAApiVersionedFieldsCTD)value; NewGridForm ui = new NewGridForm((IGenericAdd)field.owner[field.field].Value); edSvc.ShowDialog(ui); return(field.owner[field.field].Value); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { ICollectionAApiVersionedFieldsCTD ctd = value as ICollectionAApiVersionedFieldsCTD; ICollection ary = (ICollection)ctd.owner[ctd.field].Value; if (typeof(string).Equals(destinationType)) { return(ary == null ? "(null)" : "(Collection: 0x" + ary.Count.ToString("X") + ")"); } return(base.ConvertTo(context, culture, value, destinationType)); }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { ICollectionAApiVersionedFieldsCTD ctd = value as ICollectionAApiVersionedFieldsCTD; ICollection ary = (ICollection)ctd.owner[ctd.field].Value; AApiVersionedFieldsCTD.TypedValuePropertyDescriptor[] pds = new AApiVersionedFieldsCTD.TypedValuePropertyDescriptor[ary.Count]; string fmt = "[{0:X" + ary.Count.ToString("X").Length + "}] {1}"; for (int i = 0; i < ary.Count; i++) { try { pds[i] = new AApiVersionedFieldsCTD.TypedValuePropertyDescriptor(ctd.owner, String.Format(fmt, i, ctd.field), new Attribute[] { }); } catch (Exception ex) { throw ex; } } return(new PropertyDescriptorCollection(pds)); }