Пример #1
0
        /// <summary>
        /// Removes the owners of this ResourceDictionary from the given 
        /// merged dictionary.  The merged dictionary will be left with
        /// whatever owners it had before being merged.
        /// </summary>
        /// <param name="mergedDictionary"></param> 
        internal void RemoveParentOwners(ResourceDictionary mergedDictionary)
        { 
            if (_ownerFEs != null) 
            {
                foreach (Object o in _ownerFEs) 
                {
                    FrameworkElement fe = o as FrameworkElement;
                    mergedDictionary.RemoveOwner(fe);
 
                }
            } 
 
            if (_ownerFCEs != null)
            { 
                Invariant.Assert(_ownerFCEs.Count > 0);

                foreach (Object o in _ownerFCEs)
                { 
                    FrameworkContentElement fec = o as FrameworkContentElement;
                    mergedDictionary.RemoveOwner(fec); 
 
                }
            } 

            if (_ownerApps != null)
            {
                Invariant.Assert(_ownerApps.Count > 0); 

                foreach (Object o in _ownerApps) 
                { 
                    Application app = o as Application;
                    mergedDictionary.RemoveOwner(app); 

                }
            }
        }