Example #1
0
        public override PropertyDescriptor GetPropertyDescriptor(Type type, string name)
        {
            var propertyDescriptor = base.GetPropertyDescriptor(type, name);

            if (null != propertyDescriptor)
            {
                return(propertyDescriptor);
            }
            if (null == type)
            {
                return(null);
            }
            propertyDescriptor = RatioPropertyDescriptor.GetProperty(Document, type, name);
            if (null != propertyDescriptor)
            {
                return(propertyDescriptor);
            }
            if (name.StartsWith(AnnotationDef.ANNOTATION_PREFIX))
            {
                var annotationTargets = GetAnnotationTargets(type);
                if (!annotationTargets.IsEmpty)
                {
                    var annotationDef = new AnnotationDef(name.Substring(AnnotationDef.ANNOTATION_PREFIX.Length),
                                                          annotationTargets, AnnotationDef.AnnotationType.text, new string[0]);
                    return(new AnnotationPropertyDescriptor(this, annotationDef, false));
                }
            }

            return(null);
        }