Пример #1
0
        //
        //  This method
        //  1. Adds a ChildPropertyDependent entry to the given
        //     ResourceDependents list. This is used when invalidating
        //     resource references
        //
        private static void AddResourceDependent(
            int                                             childIndex,
            DependencyProperty                              dp,
            object                                          name,
            ref FrugalStructList<ChildPropertyDependent>    resourceDependents)
        {
            bool add = true;

            for (int i = 0; i < resourceDependents.Count; i++)
            {
                // Check for duplicate entry
                ChildPropertyDependent resourceDependent = resourceDependents[i];
                if ((resourceDependent.ChildIndex == childIndex) &&
                    (resourceDependent.Property == dp) &&
                    (resourceDependent.Name == name))
                {
                    add = false;
                    break;
                }
            }

            if (add)
            {
                // Since there isn't a duplicate entry,
                // create and add a new one
                ChildPropertyDependent resourceDependent = new ChildPropertyDependent();
                resourceDependent.ChildIndex = childIndex;
                resourceDependent.Property = dp;
                resourceDependent.Name = name;

                resourceDependents.Add(resourceDependent);
            }
        }
Пример #2
0
        //
        //  This method
        //  1. Adds a ChildPropertyDependent entry to the given
        //     PropertyDependents list. This is used when invalidating
        //     properties dependent upon a certain property on the container.
        //     The dependent properties could have originated from a Trigger
        //     or from a property alias on a TemplateNode.
        //
        private static void AddPropertyDependent(
            int                                             childIndex,
            DependencyProperty                              dp,
            ref FrugalStructList<ChildPropertyDependent>    propertyDependents)
        {
            ChildPropertyDependent dependent = new ChildPropertyDependent();
            dependent.ChildIndex = childIndex;
            dependent.Property = dp;

            propertyDependents.Add(dependent);
        }