Exemple #1
0
        public static XamlPropertyName Parse(TypeDefinition parent, XName name, XamlContext txt)
        {
            var xmlns            = ParseXmlNs(name.NamespaceName, txt);
            XamlPropertyName ret = new XamlPropertyName();

            if (name.LocalName.Contains("."))
            {
                int idx = name.LocalName.IndexOf('.');
                ret.TypeName     = name.LocalName.Substring(0, idx);
                ret.PropertyName = name.LocalName.Substring(idx + 1);

                XmlNsDef nsDef;
                ret.TypeDef   = Resolve(xmlns, ret.TypeName, out nsDef);
                ret.Assembly  = nsDef.Assembly;
                ret.Xmlns     = name.NamespaceName;
                ret.Namespace = nsDef.ClrNamespace;
            }
            else
            {
                ret.PropertyName = name.LocalName;
                ret.TypeDef      = parent;
                ret.Assembly     = parent.Module.Assembly;
                ret.Xmlns        = name.NamespaceName;
                ret.Namespace    = parent.Namespace;
            }

            return(ret);
        }
Exemple #2
0
        public static XamlPropertyName Parse(TypeDefinition parent, XName name, XamlContext txt)
        {
            var xmlns = ParseXmlNs(name.NamespaceName, txt);
            XamlPropertyName ret = new XamlPropertyName();
            if (name.LocalName.Contains("."))
            {
                int idx = name.LocalName.IndexOf('.');
                ret.TypeName = name.LocalName.Substring(0, idx);
                ret.PropertyName = name.LocalName.Substring(idx + 1);

                XmlNsDef nsDef;
                ret.TypeDef = Resolve(xmlns, ret.TypeName, out nsDef);
                ret.Assembly = nsDef.Assembly;
                ret.Xmlns = name.NamespaceName;
                ret.Namespace = nsDef.ClrNamespace;
            }
            else
            {
                ret.PropertyName = name.LocalName;
                ret.TypeDef = parent;
                ret.Assembly = parent.Module.Assembly;
                ret.Xmlns = name.NamespaceName;
                ret.Namespace = parent.Namespace;
            }

            return ret;
        }