示例#1
0
        internal static void ApplyCore(System.Windows.ResourceDictionary resources, ThemeDictionaryBase themeResources)
        {
            ValidationHelper.NotNull(resources, "resources");
            ValidationHelper.NotNull(themeResources, "themeResources");

            // Bug in WPF 4: http://connect.microsoft.com/VisualStudio/feedback/details/555322/global-wpf-styles-are-not-shown-when-using-2-levels-of-references
            if (resources.Keys.Count == 0)
            {
                resources.Add(typeof(Window), new Style(typeof(Window)));
            }

            var genericDictionary = new System.Windows.ResourceDictionary {
                Source = GenericDictionaryUri
            };

            genericDictionary.MergedDictionaries.Clear();
            genericDictionary.MergedDictionaries.Add(ThemeDictionaryConverter.Convert(themeResources));
            resources.SafeInject(genericDictionary);
        }