private static string GetSource(ResourceDictionary resourceDictionary)
        {
            SharedResourceDictionary sharedResourceDictionary = resourceDictionary as SharedResourceDictionary;

            if (sharedResourceDictionary != null)
            {
                return(sharedResourceDictionary.Source);
            }

            return(resourceDictionary.Source.ToString());
        }
Пример #2
0
        internal static void AddExtraResourceDictionary(
            ResourceDictionary resourceDictionary,
            Theme theme,
            Color accentColor,
            Color contrastColor,
            Color semitransparentContrastColor)
        {
            if (!resourceDictionary.MergedDictionaries.Any(x => x.Source == ElysiumExtraDictionaryUri))
            {
                SharedResourceDictionary sharedResourceDictionary = new SharedResourceDictionary()
                {
                    Source = ElysiumExtraDictionaryUri.ToString()
                };

                UpdateTheme(sharedResourceDictionary, theme);
                UpdateAccentColor(sharedResourceDictionary, accentColor);
                UpdateContrastColor(sharedResourceDictionary, contrastColor);
                UpdateSemitransparentContrastColor(sharedResourceDictionary, semitransparentContrastColor);

                resourceDictionary.MergedDictionaries.Add(sharedResourceDictionary);
            }
        }