public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
{
if (propertyValues != null)
{
if (context.PropertyDescriptor.PropertyType == typeof(DoubleRange))
{
double max = (double)propertyValues["Max"];
double min = (double)propertyValues["Min"];
return new DoubleRange(min, max);
}
else if (context.PropertyDescriptor.PropertyType == typeof(IntRange))
{
int max = (int)propertyValues["Max"];
int min = (int)propertyValues["Min"];
return new IntRange(min, max);
}
}
return base.CreateInstance(context, propertyValues);
}