internal static object CreateObjectFromAttributeText(string valueText, Type targetType, XamlObject scope) { var converter = XamlNormalPropertyInfo.GetCustomTypeConverter(targetType) ?? TypeDescriptor.GetConverter(targetType); return(converter.ConvertFromInvariantString( scope.OwnerDocument.GetTypeDescriptorContext(scope), valueText)); }
internal static object CreateObjectFromAttributeText(string valueText, Type targetType, XamlObject scope) { try { var converter = XamlNormalPropertyInfo.GetCustomTypeConverter(targetType) ?? TypeDescriptor.GetConverter(targetType); return(converter.ConvertFromInvariantString( scope.OwnerDocument.GetTypeDescriptorContext(scope), valueText)); } catch (Exception e) { IXamlErrorSink sink = (IXamlErrorSink)scope.OwnerDocument.ServiceProvider.GetService(typeof(IXamlErrorSink)); if (sink != null) { sink.ReportError(e.Message, 0, 0); } } return(null); }