public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { bool?nullable; if (value is bool) { return((bool?)value); } string str = value as string; if (str == null && value != null) { return(TypeConverters.ConvertFrom <bool?>(this, value, null)); } if (!string.IsNullOrEmpty(str)) { nullable = new bool?(bool.Parse(str)); } else { bool?nullable1 = null; nullable = nullable1; } return(nullable); }
public object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string text = (string)value; if (string.IsNullOrEmpty(text)) { return(Duration.Automatic); } if (text.ToLower() == "automatic") { return(Duration.Automatic); } else if (text.ToLower() == "forever") { return(Duration.Forever); } else { return(new Duration(TimeSpan.Parse(text))); } } return(TypeConverters.ConvertFrom <Duration>(this, value)); }
public object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string str_val = value as string; if (str_val != null) { return(new PropertyPath(str_val)); } return(TypeConverters.ConvertFrom <PropertyPath>(this, value)); }
public object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string text; if (value is bool) { return((bool?)value); } text = value as string; if (text != null || value == null) { return((!string.IsNullOrEmpty(text)) ? (bool?)bool.Parse(text) : null); } return(TypeConverters.ConvertFrom <bool?>(this, value)); }
public object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return(TypeConverters.ConvertFrom <FontWeight>(this, value)); }
public object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return(TypeConverters.ConvertFrom <TextDecorationCollection>(this, value)); }