protected virtual void BuildPropertyEditor(PropertyDescriptor descriptor) { PropertyEditor editor = InstantiatePropertyEditor(descriptor); if (editor == null) { return; } if (descriptor.Range != null) { if (descriptor.Range is RangeInt) { RangeIntEditor rangeEditor = editor as RangeIntEditor; rangeEditor.Min = (int)descriptor.Range.Min; rangeEditor.Max = (int)descriptor.Range.Max; } else if (descriptor.Range is RangeOptions) { RangeOptions range = (RangeOptions)descriptor.Range; OptionsEditor optionsEditor = editor as OptionsEditor; optionsEditor.Options = range.Options; } else { RangeEditor rangeEditor = editor as RangeEditor; rangeEditor.Min = descriptor.Range.Min; rangeEditor.Max = descriptor.Range.Max; } } InitEditor(editor, descriptor); }