public ThemeManager(MahAppsTheme theme, MahAppsAccent accent, IResourceManager iconManager) { CurrentTheme = theme; CurrentAccent = accent; _theme = new ResourceDictionary { Source = new Uri($"pack://application:,,,/MahApps.Metro;component/Styles/Accents/{CurrentTheme}.xaml") }; _accent = new ResourceDictionary { Source = new Uri($"pack://application:,,,/MahApps.Metro;component/Styles/Accents/{CurrentAccent}.xaml") }; _themeResources = new List <ResourceDictionary> { new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml") }, new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml") }, new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml") }, _accent, _theme, }; _themeResources.AddRange(iconManager.GetResources()); }
public void ChangeAppStyle(MahAppsTheme theme, MahAppsAccent accent) { var appTheme = MahApps.Metro.ThemeManager.GetAppTheme(nameof(theme)); var appAccent = MahApps.Metro.ThemeManager.GetAccent(nameof(accent)); _theme.Source = appTheme.Resources.Source; _accent.Source = appAccent.Resources.Source; CurrentTheme = theme; CurrentAccent = accent; }