public static void ChangeAppTheme(Window window, string themeName) { if (window == null) { throw new ArgumentNullException("window"); } if (themeName == null) { throw new ArgumentNullException("themeName"); } Tuple <AppTheme, Accent> tuple = ThemeManager.DetectAppStyle(window); AppTheme appTheme = ThemeManager.GetAppTheme(themeName); AppTheme appTheme1 = appTheme; if (appTheme != null) { ThemeManager.ChangeAppStyle(window.Resources, tuple, tuple.Item2, appTheme1); } }
public static object GetResourceFromAppStyle(Window window, string key) { Tuple <AppTheme, Accent> tuple = (window != null ? ThemeManager.DetectAppStyle(window) : ThemeManager.DetectAppStyle(Application.Current)); if (tuple == null && window != null) { tuple = ThemeManager.DetectAppStyle(Application.Current); } if (tuple == null) { return(null); } object item = tuple.Item1.Resources[key]; object obj = tuple.Item2.Resources[key]; if (obj != null) { return(obj); } return(item); }
public static Tuple <AppTheme, Accent> DetectAppStyle(Window window) { if (window == null) { throw new ArgumentNullException("window"); } Tuple <AppTheme, Accent> tuple = ThemeManager.DetectAppStyle(window.Resources) ?? ThemeManager.DetectAppStyle(Application.Current.Resources); return(tuple); }