public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { //use IWindowsFormsEditorService object to display a control in the dropdown area IWindowsFormsEditorService frmsvr = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (frmsvr == null) return null; object propertyConverter = null; if(context.Instance is object[]) propertyConverter = ((object[])context.Instance)[0]; else propertyConverter = context.Instance; CoronaObject obj = null; if (propertyConverter is PropertyGridConverters.ObjectPropertyConverter) { PropertyGridConverters.ObjectPropertyConverter prop = (PropertyGridConverters.ObjectPropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } else if (propertyConverter is PropertyGridConverters.SpritePropertyConverter) { PropertyGridConverters.SpritePropertyConverter prop = (PropertyGridConverters.SpritePropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } else if (propertyConverter is PropertyGridConverters.BodyElementPropertyConverter) { PropertyGridConverters.BodyElementPropertyConverter prop = (PropertyGridConverters.BodyElementPropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } if (obj != null) { CollisionGroupPropertyEditor control = new CollisionGroupPropertyEditor(obj, frmsvr); frmsvr.DropDownControl(control); if (control.SelectedItem != null) { return control.SelectedItem.ToString(); } else return "Default"; } return "Default"; }
public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { //use IWindowsFormsEditorService object to display a control in the dropdown area IWindowsFormsEditorService frmsvr = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (frmsvr == null) { return(null); } object propertyConverter = null; if (context.Instance is object[]) { propertyConverter = ((object[])context.Instance)[0]; } else { propertyConverter = context.Instance; } CoronaObject obj = null; if (propertyConverter is PropertyGridConverters.ObjectPropertyConverter) { PropertyGridConverters.ObjectPropertyConverter prop = (PropertyGridConverters.ObjectPropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } else if (propertyConverter is PropertyGridConverters.SpritePropertyConverter) { PropertyGridConverters.SpritePropertyConverter prop = (PropertyGridConverters.SpritePropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } else if (propertyConverter is PropertyGridConverters.BodyElementPropertyConverter) { PropertyGridConverters.BodyElementPropertyConverter prop = (PropertyGridConverters.BodyElementPropertyConverter)propertyConverter; obj = prop.GetObjectSelected(); } if (obj != null) { CollisionGroupPropertyEditor control = new CollisionGroupPropertyEditor(obj, frmsvr); frmsvr.DropDownControl(control); if (control.SelectedItem != null) { return(control.SelectedItem.ToString()); } else { return("Default"); } } return("Default"); }