Example #1
0
        private XamlPropertySetter XamlImplicitAttachedPropertyForName(object target, string name)
        {
            Accessors accessors;
            var       dictKey = new CachedAccessorKey(name, Type);

            if (!XamlContext.AttachedPropertyAccessorCache.TryGetValue(dictKey, out accessors))
            {
                accessors = CreateAttachedAccessors(this, Type, name);
                XamlContext.AttachedPropertyAccessorCache.Add(dictKey, accessors);
            }

            return(XamlAttachedPropertySetter.Create(this, accessors));
        }
Example #2
0
        private XamlPropertySetter LookupAttachedProperty(IXamlNode reader)
        {
            Accessors accessors;
            var       key = new CachedAccessorKey(reader.LocalName, Parser.ResolveType());

            if (!XamlContext.AttachedPropertyAccessorCache.TryGetValue(key, out accessors))
            {
                if (key.Type != null && key.Name != null)
                {
                    var name = AttachedPropertyName(key.Name);
                    accessors = CreateAttachedAccessors(this, key.Type, name);
                }
                XamlContext.AttachedPropertyAccessorCache.Add(key, accessors);
            }

            return(XamlAttachedPropertySetter.Create(this, accessors));
        }