Ejemplo n.º 1
0
 public XamlTypeResolverProvider(XamlObject containingObject)
 {
     if (containingObject == null)
     {
         throw new ArgumentNullException("containingObject");
     }
     this.document         = containingObject.OwnerDocument;
     this.containingObject = containingObject;
 }
Ejemplo n.º 2
0
 internal XamlTextValue(XamlDocument document, string textValue)
 {
     this.document = document;
     if (textValue.StartsWith("{"))
     {
         textValue = "{}" + textValue;
     }
     this.textValue = textValue;
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 internal XamlTextValue(XamlDocument document, XmlCDataSection cDataSection, XmlSpace xmlSpace)
 {
     this.document     = document;
     this.xmlSpace     = xmlSpace;
     this.cDataSection = cDataSection;
 }
Ejemplo n.º 6
0
 internal XamlTextValue(XamlDocument document, XmlText textNode, XmlSpace xmlSpace)
 {
     this.document = document;
     this.xmlSpace = xmlSpace;
     this.textNode = textNode;
 }
Ejemplo n.º 7
0
 internal XamlTextValue(XamlDocument document, XmlAttribute attribute)
 {
     this.document  = document;
     this.attribute = attribute;
 }