Пример #1
0
        //  ========================== private ================================

        private XamlMember GetXamlAttributeProperty(XamlParserContext context, XamlPropertyName propName,
                                                    XamlType tagType, string tagNamespace, bool tagIsRoot)
        {
            XamlMember prop = null;
            string     ns   = context.GetAttributeNamespace(propName, tagNamespace);

            // No Namespace, == Unknown Property
            if (ns == null)
            {
                XamlMember unknownProperty;
                if (propName.IsDotted)
                {
                    XamlType attachedOwnerType = new XamlType(string.Empty, propName.OwnerName, null, context.SchemaContext);
                    unknownProperty = new XamlMember(propName.Name, attachedOwnerType, true /*isAttachable*/);
                }
                else
                {
                    unknownProperty = new XamlMember(propName.Name, tagType, false);
                }
                return(unknownProperty);
            }

            // Get the property (attached, normal, or directive)
            if (propName.IsDotted)
            {
                prop = context.GetDottedProperty(tagType, tagNamespace, propName, tagIsRoot);
            }
            else
            {
                prop = context.GetNoDotAttributeProperty(tagType, propName, tagNamespace, ns, tagIsRoot);
            }

            return(prop);
        }
Пример #2
0
        private void ResolvePropertyName(string longName)
        {
            XamlPropertyName propName = XamlPropertyName.Parse(longName);

            if (propName == null)
            {
                throw new ArgumentException(SR.Get(SRID.MalformedPropertyName));
            }

            XamlMember prop = null;
            XamlType   declaringType;
            XamlType   tagType      = _context.CurrentType;
            string     tagNamespace = _context.CurrentTypeNamespace;

            if (propName.IsDotted)
            {
                prop = _context.GetDottedProperty(tagType, tagNamespace, propName, false /*tagIsRoot*/);
            }
            // Regular property p
            else
            {
                string ns = _context.GetAttributeNamespace(propName, Namespace);
                declaringType = _context.CurrentType;
                prop          = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, false /*tagIsRoot*/);
            }
            _tokenProperty = prop;
        }
        private XamlMember GetXamlAttributeProperty(XamlParserContext context, XamlPropertyName propName, XamlType tagType, string tagNamespace, bool tagIsRoot)
        {
            string attributeNamespace = context.GetAttributeNamespace(propName, tagNamespace);

            if (attributeNamespace == null)
            {
                if (propName.IsDotted)
                {
                    return(new XamlMember(propName.Name, new XamlType(string.Empty, propName.OwnerName, null, context.SchemaContext), true));
                }
                return(new XamlMember(propName.Name, tagType, false));
            }
            if (propName.IsDotted)
            {
                return(context.GetDottedProperty(tagType, tagNamespace, propName, tagIsRoot));
            }
            return(context.GetNoDotAttributeProperty(tagType, propName, tagNamespace, attributeNamespace, tagIsRoot));
        }