private static void OnThemeChanged(FrameworkElement fre, Theme theme) { var themeKey = theme?.GetThemeKey(ThemeKey.GetDefaultType(fre)); if (themeKey != null) { fre.SetValue(DefaultStyleKeyProperty, themeKey); } }
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); }
private bool Equals(ThemeKey other) { return(base.Equals(other) && ElementType == other.ElementType && Equals(Theme, other.Theme)); }
internal override Assembly GetThemeKeyAssembly(ThemeKey themeKey) { return(SkinnedTheme.GetThemeKeyAssembly(themeKey)); }
private static void RegisterGenericThemeKey(GenericResourceDictionary genericDictionary, ThemeKey themeKey) { if (themeKey.ThemeStyle != null) { genericDictionary[themeKey] = themeKey.ThemeStyle.NativeStyle; } }
internal virtual Assembly GetThemeKeyAssembly(ThemeKey themeKey) { return(themeKey.Theme.GetType().Assembly); }