internal static void PromoteAllCachedDefaultValues(DependencyObject owner) { FrugalMapBase map = _defaultValueFactoryCache.GetValue(owner); if (map != null) { // Iterate through all the items in the map (each representing a DP) // and promote them to locally-set. map.Iterate(null, _promotionCallback); } }
/// <summary> /// Removes all cached default values on an object. It iterates though /// each one and, if the cached default is a Freezable, removes its /// Changed event handlers. This is called by DependencyObject.Seal() /// for Freezable type owners. /// </summary> /// <param name="owner"></param> internal static void RemoveAllCachedDefaultValues(Freezable owner) { FrugalMapBase map = _defaultValueFactoryCache.GetValue(owner); if (map != null) { // Iterate through all the items in the map (each representing a DP) // and remove the promotion handlers map.Iterate(null, _removalCallback); // Now that they're all clear remove the map. _defaultValueFactoryCache.ClearValue(owner); } }