public static bool IsThemeDictionary(ResourceDictionary resourceDictionary) { if (resourceDictionary is null) { throw new ArgumentNullException(nameof(resourceDictionary)); } var source = resourceDictionary.Source; if (!(source is null)) { if (ThemeDictionaryCache.TryGetValue(source, out var existingValue)) { return(existingValue); } } // We are not allowed to use other methods like GetThemeInstance or GetThemeName here as that would cause an endless-loop var result = ResourceDictionaryHelper.ContainsKey(resourceDictionary, ThemeInstanceKey) || string.IsNullOrEmpty(ResourceDictionaryHelper.GetValueFromKey(resourceDictionary, ThemeNameKey) as string) == false; if (!(source is null)) { ThemeDictionaryCache[source] = result; } return(result); }
public static bool IsRuntimeGeneratedThemeDictionary(ResourceDictionary resourceDictionary) { if (IsThemeDictionary(resourceDictionary)) { return((ResourceDictionaryHelper.ContainsKey(resourceDictionary, ThemeInstanceKey) && ((Theme)resourceDictionary[ThemeInstanceKey]).IsRuntimeGenerated) || (ResourceDictionaryHelper.ContainsKey(resourceDictionary, ThemeIsRuntimeGeneratedKey) && (bool)resourceDictionary[ThemeIsRuntimeGeneratedKey])); } return(false); }
public static bool IsRuntimeGeneratedThemeDictionary(ResourceDictionary resourceDictionary) { return(Theme.IsRuntimeGeneratedThemeDictionary(resourceDictionary) || (ResourceDictionaryHelper.ContainsKey(resourceDictionary, LibraryThemeInstanceKey) && ((LibraryTheme)resourceDictionary[LibraryThemeInstanceKey]).IsRuntimeGenerated)); }
public static bool IsThemeDictionary(ResourceDictionary resourceDictionary) { return(Theme.IsThemeDictionary(resourceDictionary) || ResourceDictionaryHelper.ContainsKey(resourceDictionary, LibraryThemeInstanceKey)); }