Beispiel #1
0
        public void Visit(ListNode node, INode parentNode)
        {
            XmlName name;

            if (EXamlSetPropertiesVisitor.TryGetPropertyName(node, parentNode, out name))
            {
                node.XmlName = name;
            }
        }
        public void Visit(ElementNode node, INode parentNode)
        {
            XmlName propertyName;

            //Set ResourcesDictionaries to their parents
            if (IsResourceDictionary(node) && EXamlSetPropertiesVisitor.TryGetPropertyName(node, parentNode, out propertyName))
            {
                string realPropertyName;
                if (propertyName.LocalName.EndsWith(".XamlResources", StringComparison.Ordinal))
                {
                    realPropertyName = propertyName.LocalName.Substring(propertyName.LocalName.Length - ".XamlResources".Length);
                }
                else
                {
                    realPropertyName = propertyName.LocalName;
                }

                if (realPropertyName == "XamlResources")
                {
                    new EXamlSetProperty(Context, Context.Values[parentNode] as EXamlCreateObject, realPropertyName, Context.Values[node]);
                    //Context.IL.Append(SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node));
                    return;
                }
            }

            //Only proceed further if the node is a keyless RD
            if (parentNode is IElementNode &&
                IsResourceDictionary((IElementNode)parentNode) &&
                !((IElementNode)parentNode).Properties.ContainsKey(XmlName.xKey))
            {
                node.Accept(new EXamlSetPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
            }
            else if (parentNode is ListNode &&
                     IsResourceDictionary((IElementNode)parentNode.Parent) &&
                     !((IElementNode)parentNode.Parent).Properties.ContainsKey(XmlName.xKey))
            {
                node.Accept(new EXamlSetPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
            }
        }