internal static ResourceDictionary?GetContainingResourceDictionaryDebug(this DependencyObject obj) { var source = ResourceDictionary.GetResourceSource(obj); return(source?.ContainingDictionary); }
internal static string GetResourceNameDebug(this DependencyObject obj) { var source = ResourceDictionary.GetResourceSource(obj); return(source?.ResourceKey.Key ?? "No associated key found. Make sure you uncommented '//#define DEBUG_SET_RESOURCE_SOURCE' in ResourceDictionary.cs"); }