Skip to content

Commit

Permalink
update in themes.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjinhuagood committed Oct 27, 2022
1 parent c5c4c3e commit 8f50e74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SoftwareHelper/Helpers/ThemesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public static void SetLightDark(bool isDark)
{
var existingResourceDictionary = Application.Current.Resources.MergedDictionaries
.Where(rd => rd.Source != null)
.SingleOrDefault(rd => rd.Source.OriginalString.Contains("Light") || rd.Source.OriginalString.Contains("Dark"));
.SingleOrDefault(rd => rd.Source.OriginalString.Contains("/SoftwareHelper;component/Themes")
&&
(rd.Source.OriginalString.Contains("Light") || rd.Source.OriginalString.Contains("Dark")));
var source = $"pack://application:,,,/SoftwareHelper;component/Themes/{(isDark ? "Dark" : "Light")}.xaml";
var newResourceDictionary = new ResourceDictionary() { Source = new Uri(source) };
App.Current.Resources.MergedDictionaries.Remove(existingResourceDictionary);
Expand Down

0 comments on commit 8f50e74

Please sign in to comment.