예제 #1
0
 public XamlTypeResolverProvider(XamlObject containingObject)
 {
     if (containingObject == null)
     {
         throw new ArgumentNullException("containingObject");
     }
     this.document         = containingObject.OwnerDocument;
     this.containingObject = containingObject;
 }
예제 #2
0
 internal XamlTextValue(XamlDocument document, string textValue)
 {
     this.document = document;
     if (textValue.StartsWith("{"))
     {
         textValue = "{}" + textValue;
     }
     this.textValue = textValue;
 }
예제 #3
0
        /// <summary>For use by XamlParser only.</summary>
        internal XamlObject(XamlDocument document, XmlElement element, Type elementType, object instance)
        {
            this.document    = document;
            this.element     = element;
            this.elementType = elementType;
            this.instance    = instance;

            this.contentPropertyName = GetContentPropertyName(elementType);
            XamlSetTypeConverter     = GetTypeConverterDelegate(elementType);

            ServiceProvider = new XamlObjectServiceProvider(this);
            CreateWrapper();

            var rnpAttrs =
                elementType.GetCustomAttributes(typeof(RuntimeNamePropertyAttribute),
                                                true) as RuntimeNamePropertyAttribute[];

            if (rnpAttrs != null && rnpAttrs.Length > 0 && !String.IsNullOrEmpty(rnpAttrs[0].Name))
            {
                runtimeNameProperty = rnpAttrs[0].Name;
            }
        }
예제 #4
0
        static XmlNode FindChildNode(XmlNode node, Type elementType, string propertyName, XamlDocument xamlDocument)
        {
            var localName       = elementType.Name + "." + propertyName;
            var namespacesURI   = xamlDocument.GetNamespacesFor(elementType);
            var clrNamespaceURI = xamlDocument.GetNamespaceFor(elementType, true);

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == localName && (namespacesURI.Contains(childNode.NamespaceURI) ||
                                                         childNode.NamespaceURI == clrNamespaceURI))
                {
                    return(childNode);
                }
            }

            var type = elementType.BaseType;

            namespacesURI = xamlDocument.GetNamespacesFor(type);

            while (type != typeof(object))
            {
                if (type.GetProperty(propertyName) == null)
                {
                    break;
                }

                localName = type.Name + "." + propertyName;

                foreach (XmlNode childNode in node.ChildNodes)
                {
                    if (childNode.LocalName == localName && namespacesURI.Contains(childNode.NamespaceURI))
                    {
                        return(childNode);
                    }
                }

                type = type.BaseType;
            }

            return(null);
        }
예제 #5
0
 internal XamlTextValue(XamlDocument document, XmlCDataSection cDataSection, XmlSpace xmlSpace)
 {
     this.document     = document;
     this.xmlSpace     = xmlSpace;
     this.cDataSection = cDataSection;
 }
예제 #6
0
 internal XamlTextValue(XamlDocument document, XmlText textNode, XmlSpace xmlSpace)
 {
     this.document = document;
     this.xmlSpace = xmlSpace;
     this.textNode = textNode;
 }
예제 #7
0
 internal XamlTextValue(XamlDocument document, XmlAttribute attribute)
 {
     this.document  = document;
     this.attribute = attribute;
 }