GetPropertyInfo() статический приватный Метод

static private GetPropertyInfo ( XamlTypeFinder typeFinder, object elementInstance, Type elementType, string xmlNamespace, string localName, bool tryFindAllProperties = false ) : XamlPropertyInfo
typeFinder XamlTypeFinder
elementInstance object
elementType Type
xmlNamespace string
localName string
tryFindAllProperties bool
Результат XamlPropertyInfo
Пример #1
0
        public XamlPropertyInfo ResolveProperty(string propertyName)
        {
            string propertyNamespace;

            if (propertyName.Contains(":"))
            {
                propertyNamespace = ContainingElement.GetNamespaceOfPrefix(propertyName.Substring(0, propertyName.IndexOf(':')));
                propertyName      = propertyName.Substring(propertyName.IndexOf(':') + 1);
            }
            else
            {
                propertyNamespace = ContainingElement.GetNamespaceOfPrefix("");
            }
            Type       elementType = null;
            XamlObject obj         = containingObject;

            while (obj != null)
            {
                Style style = obj.Instance as Style;
                if (style != null && style.TargetType != null)
                {
                    elementType = style.TargetType;
                    break;
                }
                obj = obj.ParentObject;
            }
            if (propertyName.Contains("."))
            {
                var allPropertiesAllowed = this.containingObject is XamlObject && (((XamlObject)this.containingObject).ElementType == typeof(Setter) || ((XamlObject)this.containingObject).IsMarkupExtension);
                return(XamlParser.GetPropertyInfo(document.TypeFinder, null, elementType, propertyNamespace, propertyName, allPropertiesAllowed));
            }
            else if (elementType != null)
            {
                return(XamlParser.FindProperty(null, elementType, propertyName));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public XamlPropertyInfo ResolveProperty(string propertyName)
        {
            string propertyNamespace;

            if (propertyName.Contains(":"))
            {
                propertyNamespace = ContainingElement.GetNamespaceOfPrefix(propertyName.Substring(0, propertyName.IndexOf(':')));
                propertyName      = propertyName.Substring(propertyName.IndexOf(':') + 1);
            }
            else
            {
                propertyNamespace = ContainingElement.GetNamespaceOfPrefix("");
            }
            Type       elementType = null;
            XamlObject obj         = containingObject;

            while (obj != null)
            {
                Style style = obj.Instance as Style;
                if (style != null && style.TargetType != null)
                {
                    elementType = style.TargetType;
                    break;
                }
                obj = obj.ParentObject;
            }
            if (propertyName.Contains("."))
            {
                return(XamlParser.GetPropertyInfo(document.TypeFinder, null, elementType, propertyNamespace, propertyName));
            }
            else if (elementType != null)
            {
                return(XamlParser.FindProperty(null, elementType, propertyName));
            }
            else
            {
                return(null);
            }
        }