virtual XamlValueConverter <TypeConverter> LookupTypeConverter() { var t = Type.UnderlyingType; if (t == null) { return(null); } if (t == typeof(object)) // it is different from XamlType.LookupTypeConverter(). { return(null); } var xamlTypeConverter = LookupXamlTypeConverter(); if (xamlTypeConverter != null) { return(new XamlXamlTypeValueConverter(xamlTypeConverter, Type)); } var converterName = CustomAttributeProvider.GetTypeConverterName(false); if (converterName != null) { return(context.GetValueConverter <TypeConverter>(System.Type.GetType(converterName), Type)); } if (IsEvent) { return(context.GetValueConverter <TypeConverter>(typeof(EventConverter), Type)); } return(Type.TypeConverter); }
protected virtual XamlValueConverter <TypeConverter> LookupTypeConverter() { var t = Type.UnderlyingType; if (t == null) { return(null); } if (t == typeof(object)) // it is different from XamlType.LookupTypeConverter(). { return(null); } var a = CustomAttributeProvider; var ca = a != null?a.GetCustomAttribute <TypeConverterAttribute>(false) : null; if (ca != null) { return(context.GetValueConverter <TypeConverter>(System.Type.GetType(ca.ConverterTypeName), Type)); } #if NETSTANDARD if (IsEvent) { return(context.GetValueConverter <TypeConverter>(typeof(EventConverter), Type)); } #endif return(Type.TypeConverter); }