internal static TypeConverter GetCoreConverterFromCustomType(Type type) { TypeConverter typeConverter = null; if (type.IsEnum) { // Need to handle Enums types specially as they require a ctor that // takes the underlying type. typeConverter = new System.ComponentModel.EnumConverter(type); } else if (typeof(Int32).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int32Converter(); } else if (typeof(Int16).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int16Converter(); } else if (typeof(Int64).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int64Converter(); } else if (typeof(UInt32).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt32Converter(); } else if (typeof(UInt16).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt16Converter(); } else if (typeof(UInt64).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt64Converter(); } else if (typeof(Boolean).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.BooleanConverter(); } else if (typeof(Double).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.DoubleConverter(); } else if (typeof(Single).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.SingleConverter(); } else if (typeof(Byte).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.ByteConverter(); } else if (typeof(SByte).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.SByteConverter(); } else if (typeof(Char).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.CharConverter(); } else if (typeof(Decimal).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.DecimalConverter(); } else if (typeof(TimeSpan).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.TimeSpanConverter(); } else if (typeof(Guid).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.GuidConverter(); } else if (typeof(String).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.StringConverter(); } else if (typeof(CultureInfo).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.CultureInfoConverter(); } #if !SYSTEM_XAML else if (typeof(Type).IsAssignableFrom(type)) { typeConverter = new System.Windows.Markup.TypeTypeConverter(); } #else else if (type == typeof(Type)) { typeConverter = new System.Xaml.Replacements.TypeTypeConverter(); } #endif else if (typeof(DateTime).IsAssignableFrom(type)) { typeConverter = new DateTimeConverter2(); } else if (typeof(Uri).IsAssignableFrom(type)) { typeConverter = new System.Xaml.Replacements.TypeUriConverter(); } return(typeConverter); }
internal static TypeConverter GetCoreConverterFromCustomType(Type type) { TypeConverter typeConverter = null; if (type.IsEnum) { // Need to handle Enums types specially as they require a ctor that // takes the underlying type. typeConverter = new System.ComponentModel.EnumConverter(type); } else if (typeof(Int32).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int32Converter(); } else if (typeof(Int16).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int16Converter(); } else if (typeof(Int64).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.Int64Converter(); } else if (typeof(UInt32).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt32Converter(); } else if (typeof(UInt16).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt16Converter(); } else if (typeof(UInt64).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.UInt64Converter(); } else if (typeof(Boolean).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.BooleanConverter(); } else if (typeof(Double).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.DoubleConverter(); } else if (typeof(Single).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.SingleConverter(); } else if (typeof(Byte).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.ByteConverter(); } else if (typeof(SByte).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.SByteConverter(); } else if (typeof(Char).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.CharConverter(); } else if (typeof(Decimal).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.DecimalConverter(); } else if (typeof(TimeSpan).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.TimeSpanConverter(); } else if (typeof(Guid).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.GuidConverter(); } else if (typeof(String).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.StringConverter(); } else if (typeof(CultureInfo).IsAssignableFrom(type)) { typeConverter = new System.ComponentModel.CultureInfoConverter(); } #if !SYSTEM_XAML else if (typeof(Type).IsAssignableFrom(type)) { typeConverter = new System.Windows.Markup.TypeTypeConverter(); } #else else if (type == typeof(Type)) { typeConverter = new System.Xaml.Replacements.TypeTypeConverter(); } #endif else if (typeof(DateTime).IsAssignableFrom(type)) { typeConverter = new DateTimeConverter2(); } return typeConverter; }
private static TypeConverter GetCoreConverterFromCoreType(Type type) { TypeConverter typeConverter = null; if (type == typeof(Int32)) { typeConverter = new System.ComponentModel.Int32Converter(); } else if (type == typeof(Int16)) { typeConverter = new System.ComponentModel.Int16Converter(); } else if (type == typeof(Int64)) { typeConverter = new System.ComponentModel.Int64Converter(); } else if (type == typeof(UInt32)) { typeConverter = new System.ComponentModel.UInt32Converter(); } else if (type == typeof(UInt16)) { typeConverter = new System.ComponentModel.UInt16Converter(); } else if (type == typeof(UInt64)) { typeConverter = new System.ComponentModel.UInt64Converter(); } else if (type == typeof(Boolean)) { typeConverter = new System.ComponentModel.BooleanConverter(); } else if (type == typeof(Double)) { typeConverter = new System.ComponentModel.DoubleConverter(); } else if (type == typeof(Single)) { typeConverter = new System.ComponentModel.SingleConverter(); } else if (type == typeof(Byte)) { typeConverter = new System.ComponentModel.ByteConverter(); } else if (type == typeof(SByte)) { typeConverter = new System.ComponentModel.SByteConverter(); } else if (type == typeof(Char)) { typeConverter = new System.ComponentModel.CharConverter(); } else if (type == typeof(Decimal)) { typeConverter = new System.ComponentModel.DecimalConverter(); } else if (type == typeof(TimeSpan)) { typeConverter = new System.ComponentModel.TimeSpanConverter(); } else if (type == typeof(Guid)) { typeConverter = new System.ComponentModel.GuidConverter(); } else if (type == typeof(String)) { typeConverter = new System.ComponentModel.StringConverter(); } else if (type == typeof(CultureInfo)) { typeConverter = new System.ComponentModel.CultureInfoConverter(); } #if !SYSTEM_XAML else if (type == typeof(Type)) { typeConverter = new System.Windows.Markup.TypeTypeConverter(); } #else else if (type == typeof(Type)) { typeConverter = new System.Xaml.Replacements.TypeTypeConverter(); } #endif else if (type == typeof(DateTime)) { typeConverter = new DateTimeConverter2(); } else if (ReflectionHelper.IsNullableType(type)) { typeConverter = new System.ComponentModel.NullableConverter(type); } return(typeConverter); }
private static TypeConverter GetCoreConverterFromCoreType(Type type) { TypeConverter typeConverter = null; if (type == typeof(Int32)) { typeConverter = new System.ComponentModel.Int32Converter(); } else if (type == typeof(Int16)) { typeConverter = new System.ComponentModel.Int16Converter(); } else if (type == typeof(Int64)) { typeConverter = new System.ComponentModel.Int64Converter(); } else if (type == typeof(UInt32)) { typeConverter = new System.ComponentModel.UInt32Converter(); } else if (type == typeof(UInt16)) { typeConverter = new System.ComponentModel.UInt16Converter(); } else if (type == typeof(UInt64)) { typeConverter = new System.ComponentModel.UInt64Converter(); } else if (type == typeof(Boolean)) { typeConverter = new System.ComponentModel.BooleanConverter(); } else if (type == typeof(Double)) { typeConverter = new System.ComponentModel.DoubleConverter(); } else if (type == typeof(Single)) { typeConverter = new System.ComponentModel.SingleConverter(); } else if (type == typeof(Byte)) { typeConverter = new System.ComponentModel.ByteConverter(); } else if (type == typeof(SByte)) { typeConverter = new System.ComponentModel.SByteConverter(); } else if (type == typeof(Char)) { typeConverter = new System.ComponentModel.CharConverter(); } else if (type == typeof(Decimal)) { typeConverter = new System.ComponentModel.DecimalConverter(); } else if (type == typeof(TimeSpan)) { typeConverter = new System.ComponentModel.TimeSpanConverter(); } else if (type == typeof(Guid)) { typeConverter = new System.ComponentModel.GuidConverter(); } else if (type == typeof(String)) { typeConverter = new System.ComponentModel.StringConverter(); } else if (type == typeof(CultureInfo)) { typeConverter = new System.ComponentModel.CultureInfoConverter(); } #if !SYSTEM_XAML else if (type == typeof(Type)) { typeConverter = new System.Windows.Markup.TypeTypeConverter(); } #else else if (type == typeof(Type)) { typeConverter = new System.Xaml.Replacements.TypeTypeConverter(); } #endif else if (type == typeof(DateTime)) { typeConverter = new DateTimeConverter2(); } else if (ReflectionHelper.IsNullableType(type)) { typeConverter = new System.ComponentModel.NullableConverter(type); } return typeConverter; }