Exemplo n.º 1
0
        private static void OnThemeChanged(FrameworkElement fre, Theme theme)
        {
            var themeKey = theme?.GetThemeKey(ThemeKey.GetDefaultType(fre));

            if (themeKey != null)
            {
                fre.SetValue(DefaultStyleKeyProperty, themeKey);
            }
        }
Exemplo n.º 2
0
        private ThemeKey CreateThemeKey(Type elementType)
        {
            var masterTheme = MasterTheme;

            if (ReferenceEquals(this, masterTheme) == false)
            {
                return(masterTheme.CreateThemeKey(elementType));
            }

            var themeStyle = _themeStyles.GetValueOrDefault(elementType);

            if (themeStyle == null)
            {
                ThemeResourceDictionaryLoader.Instance.EnsureThemePartLoaded(elementType.Assembly);

                themeStyle = _themeStyles.GetValueOrDefault(elementType);
            }

            if (themeStyle == null)
            {
                return(null);
            }

            if (themeStyle.IsDeferred)
            {
                themeStyle.EnsureDeferredStylesLoaded();

                themeStyle = _themeStyles.GetValueOrDefault(elementType);

                if (themeStyle == null)
                {
                    return(null);
                }
            }

            if (ThemeManager.EnableThemeStyle(elementType, themeStyle.TargetType) == false)
            {
                return(null);
            }

            var themeKey = new ThemeKey(elementType, this, themeStyle);

            foreach (var genericDictionary in _genericDictionaries)
            {
                RegisterGenericThemeKey(genericDictionary, themeKey);
            }

            return(themeKey);
        }
Exemplo n.º 3
0
 private bool Equals(ThemeKey other)
 {
     return(base.Equals(other) && ElementType == other.ElementType && Equals(Theme, other.Theme));
 }
Exemplo n.º 4
0
 internal override Assembly GetThemeKeyAssembly(ThemeKey themeKey)
 {
     return(SkinnedTheme.GetThemeKeyAssembly(themeKey));
 }
Exemplo n.º 5
0
 private static void RegisterGenericThemeKey(GenericResourceDictionary genericDictionary, ThemeKey themeKey)
 {
     if (themeKey.ThemeStyle != null)
     {
         genericDictionary[themeKey] = themeKey.ThemeStyle.NativeStyle;
     }
 }
Exemplo n.º 6
0
 internal virtual Assembly GetThemeKeyAssembly(ThemeKey themeKey)
 {
     return(themeKey.Theme.GetType().Assembly);
 }