Esempio n. 1
0
        private PropertyPath EvaluatePropertyPath(IServiceProvider serviceProvider)
        {
            var propertyPath = Path as PropertyPath;

            if (propertyPath != null)
            {
                return(propertyPath);
            }

            var stringPath = Path as string;
            var dpPath     = Path as DependencyProperty;

            if (stringPath != null)
            {
#if SILVERLIGHT
                return(new PropertyPath(stringPath));
#else
                using (var typeDescriptorContext = TypeDescriptorContext.FromServiceProvider(serviceProvider))
                    return((PropertyPath)PathConverter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentCulture, stringPath));
#endif
            }

            return(dpPath != null ? new PropertyPath(dpPath) : null);
        }