//Setting the right icon for each theme private void SetTrayIcon() { var theme = RegistryThemeHelper.GetWindowsTheme(); darkerIcon.IconSource = theme == UITheme.Light ? new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/day_w.ico")); }
private void SetDarkerAppTheme() { var apptheme = RegistryThemeHelper.GetAppsTheme(); if (apptheme == UITheme.Light) { Application.Current.Resources.MergedDictionaries.Clear(); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Resources/Themes/LightTheme.xaml", UriKind.Relative) }); } else { Application.Current.Resources.MergedDictionaries.Clear(); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Resources/Themes/DarkTheme.xaml", UriKind.Relative) }); } }
//Reset menu item private void Reset_Click(object sender, RoutedEventArgs e) { RegistryThemeHelper.ResetTheme(); SetTrayIcon(); SetDarkerAppTheme(); }