Inheritance: XamlPropertyInfo
Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }