// Called during Style/Template Seal when encountering a data trigger that
        //  has associated TriggerActions.
        internal static void AddDataTriggerWithAction(TriggerBase triggerBase,
            BindingBase binding, ref HybridDictionary dataTriggersWithActions )
        {
            if( dataTriggersWithActions == null )
            {
                dataTriggersWithActions = new HybridDictionary();
            }

            object existing = dataTriggersWithActions[binding];

            if( existing == null )
            {
                // No existing trigger, we put given trigger as entry.
                dataTriggersWithActions[binding] = triggerBase;
            }
            else
            {
                TriggerBase existingTriggerBase = existing as TriggerBase;
                if( existingTriggerBase != null )
                {
                    // Up-convert to list and replace.

                    List<TriggerBase> newList = new List<TriggerBase>();

                    newList.Add(existingTriggerBase);
                    newList.Add(triggerBase);

                    dataTriggersWithActions[binding] = newList;
                }
                else
                {
                    Debug.Assert( existing is List<TriggerBase>,
                        "HybridDictionary for holding List<TriggerBase> is holding an instance of unexpected type " + existing.GetType() );

                    List<TriggerBase> existingList = (List<TriggerBase>)existing;

                    existingList.Add(triggerBase);
                }
            }

            // Note the order in which we processed this trigger.
            triggerBase.EstablishLayer();
        }
        // Called during Style/Template Seal when encountering a property trigger that
        //  has associated TriggerActions.
        internal static void AddPropertyTriggerWithAction(TriggerBase triggerBase,
            DependencyProperty property, ref FrugalMap triggersWithActions)
        {
            object existing = triggersWithActions[property.GlobalIndex];

            if( existing == DependencyProperty.UnsetValue )
            {
                // No existing trigger, we put given trigger as entry.
                triggersWithActions[property.GlobalIndex] = triggerBase;
            }
            else
            {
                TriggerBase existingTriggerBase = existing as TriggerBase;
                if( existingTriggerBase != null )
                {
                    List<TriggerBase> newList = new List<TriggerBase>();

                    newList.Add(existingTriggerBase);
                    newList.Add(triggerBase);

                    triggersWithActions[property.GlobalIndex] = newList;
                }
                else
                {
                    Debug.Assert( existing is List<TriggerBase>,
                        "FrugalMap for holding List<TriggerBase> is holding an instance of unexpected type " + existing.GetType() );

                    List<TriggerBase> existingList = (List<TriggerBase>)existing;

                    existingList.Add(triggerBase);
                }
            }

            // Note the order in which we processed this trigger.
            triggerBase.EstablishLayer();
        }