public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { this.editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (this.editorService != null) { var source = context.Instance as ISource; if (source != null) { var types = source.EditorObjectTypes; if (types.Length > 0) { var type = source.ObjectType ?? types[0]; var listBox = new ObjectTypeEditorListBox(this.editorService, types, type); this.editorService.DropDownControl(listBox); if (!listBox.EscapePressed) { return(listBox.SelectedItem); } } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { this.editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (this.editorService != null) { var source = context.Instance as ISource; if (source != null) { var superclasses = source.PossibleSuperClasses; if (superclasses.Length > 0) { Array.Sort(superclasses); var listBox = new ObjectTypeEditorListBox(this.editorService); listBox.Items.Add(string.Empty); foreach (var superclass in superclasses) { listBox.Items.Add(superclass); } if (source.Superclass != null) { listBox.SelectedItem = source.Superclass; } this.editorService.DropDownControl(listBox); if (!listBox.EscapePressed) { if (listBox.SelectedItem is ObjectType) { return(listBox.SelectedItem); } return(null); } } } } return(value); }