public override object ConvertFromString(string value, IValueSerializerContext context) { Color c; if (Color.TryParse(value, out c)) { return(c); } else { throw new InvalidOperationException("Could not parse color value: " + value); } }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { Color c; if (Color.TryParse((string)value, out c)) { return(c); } else { throw new InvalidOperationException("Could not parse color value: " + value); } }